Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
titleCDB/MACI/Components/Components.xml
linenumberstrue
collapsetrue
...
<e
    Name="ComponentCallerAPI"
    Code="acs.ComponentCallerAPI"
    Type="IDL:alma/ACS/ACSComponent:1.0"
    Container="aragornContainer"
    ImplLang="py"
    Autostart="true"/>
...

Interaction

  • Start ACS
  • Start a Container
  • Interact with a component using curl. For instance to retrieve name and componentState attributes:

    Code Block
    languagebash
    > 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"}}}

Event Converter

Deployment / Configuration

  • Install redis

    Code Block
    languagebash
    > sudo yum install redis
  • Python Container
    • For instance aragornContainer with the demo CDB
  • Component Configuration

    Code Block
    languagexml
    titleCDB/MACI/Components/Components.xml
    linenumberstrue
    collapsetrue
    ...
    <e
        Name="EventConverter"
        Code="acs.EventConverter"
        Type="IDL:alma/ACS/ACSComponent:1.0"
        Container="aragornContainer"
        ImplLang="py"
        Autostart="true"/>
    ...
  • XMLDoc

    Code Block
    languagexml
    titleCDB/alma/EventConverter/EventConverter.xml
    linenumberstrue
    collapsetrue
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <EventConverter xmlns="urn:schemas-cosylab-com:EventConverter:1.0" xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <RedisConn host="localhost" port="6379"/>
      <PubSub>
        <Channel name="

...

  • example">
          <EventType type="

...

  • workshop.

...

  • ExampleEvent"/>
        </Channel>
      </PubSub>
      <ReliableSubscribers>
        <Subscriber name="

...

  • example" queueLimit="20">
          <Channel name="

...

  • example">
            <EventType type="

...

  • workshop.

...

  • ExampleEvent"/>
          </Channel>
        </Subscriber>
      </ReliableSubscribers>
    </EventConverter>
  • IDL Event Definition

    Code Block
    #ifndef _ExampleEvent_IDL_
    #define _ExampleEvent_IDL_
    
    #pragma prefix "alma"
    
    module workshop {
        const string CHANNELNAME_EXAMPLE = "example";
        struct ExampleEvent {
            string msg;
            long value;
        };
    };
    #endif

Interaction

  • Start redis-server

    Code Block
    languagebash
    > redis-server
  • Start ACS
  • Start Python aragornContainer
  • Send events with ExampleSupplier.py

    Code Block
    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

    Code Block
    > 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}}"

Discussion

  • Limitations: Callbacks
  • Improvements
  • New Ideas