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:
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
Once the component is connected the proxy can be retrieved in the onConnectComponent with
TopicProxyType getTopic(const std::string &name)
Returns a proxy of the specified topic.
- 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:
void usingTopic(const std::string &name, bool orderedPublishing=false)
Registers a proxy for subscription after initialization.
Further details can be found in Distributed Processing.