Information
We are currently investigating an issue with the editor of some pages. Please save your work and avoid to create new pages until this banner is gone.
The Component Caller API is a component that works as a proxy that makes the ACS / CORBA world in a REST API. This enables different functionality, such as connecting standalone applications, plugins and/or web services to the system.
The Event Converter is a component that serves a pre-configured set of events by converting them from ACS' Notification Channel (Based on CORBA's Notification Service) into Redis PubSub model for unreliable subscribers and into Redis queues for reliable subscribers.
At ALMA, these services are being used in a couple of places:
Interact with a component using curl. For instance to retrieve name and componentState attributes:
> curl -XPOST http://127.0.0.1:9000/ -d'{"componentName": "EventConverter", "methodName": "_get_name", "arguments": {}}' {"data": "EventConverter"} > curl -XPOST http://127.0.0.1:9000/ -d'{"componentName": "EventConverter", "methodName": "_get_componentState", "arguments": {}}' {"data": {"meta": {"type": "omniORB.EnumItem"}, "data": {"_n": "COMPSTATE_OPERATIONAL", "_v": 3, "_parent_id": "IDL:alma/ACS/ComponentStates:1.0"}}}
Install redis
> sudo yum install redis
Component Configuration
XMLDoc
IDL Event Definition
#ifndef _ExampleEvent_IDL_ #define _ExampleEvent_IDL_ #pragma prefix "alma" module workshop { const string CHANNELNAME_EXAMPLE = "example"; struct ExampleEvent { string msg; long value; }; }; #endif
Start redis-server
> redis-server
Send events with ExampleSupplier.py
import workshop from Acspy.Nc.Supplier import Supplier event = workshop.ExampleEvent("Example Supplier", 10) sup = Supplier(workshop.CHANNELNAME_EXAMPLE) sup.publishEvent(simple_data=event) sup.disconnect()
Check Redis
> redis-cli #Get all queues 127.0.0.1:6379> keys * 1) "example" #Check elements of 'example' queue 127.0.0.1:6379> LRANGE example 0 -1 1) "{\"meta\": {\"type\": \"workshop.ExampleEvent\"}, \"data\": {\"msg\": \"Example Supplier\", \"value\": 10}}"