How to offer and subscribe to a topic

Topics provide a convenient way of realize a publish-subscribe mechanism. This is useful if the number of recievers may vary. There might be 0, 1 or multiple components that implement an interface and hence retrieve the published data.

  • Publish data
    A component (or ManagedIceObject) can register itself in order to publish data. To offer the topic cal the following method in the onInitComponent part of your component:
    Once the component is connected the proxy can be retrieved in the onConnectComponent with
    listenerPrx = armarx::ManagedIceObject::getTopic<MyTopicPrx>("TopicName")
  • Retrieve data
    The component which should receive the data must implement the corresponding interface. To register the method, call the following method within the onInitComponent section of your component:

Further details can be found in Distributed Processing.

armarx::ManagedIceObject::usingTopic
void usingTopic(const std::string &name, bool orderedPublishing=false)
Registers a proxy for subscription after initialization.
Definition: ManagedIceObject.cpp:248
armarx::ManagedIceObject::offeringTopic
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
Definition: ManagedIceObject.cpp:290