Implementing an IceStorm Subscriber
2 min read
2 min read
2 min read
2 min read
2 min read
2 min read
2 min read
2 min read
2 min read
An IceStorm subscriber is an Ice server application that hosts a subscriber object, and registers a proxy to this object with a Topic hosted by the IceStorm service.
The IceStorm/weather demo program provides a complete subscriber application. It’s available in all programming languages with server-side support.
Our weather station implementation takes the following steps:
- Obtain a proxy for the
TopicManager. This is the primary IceStorm object, used by both publishers and subscribers. - Obtain a proxy for the
weathertopic by callingcreateOrRetrieve("weather")on theTopicManager. - Create an object adapter to host our
WeatherStationservant. - Instantiate the servant and add the servant to the object adapter.
- Activate the object adapter, so that it dispatches the events IceStorm delivers to the servant.
- Activate the object adapter so that it can dispatch the events IceStorm delivers to the servant.
- Subscribe to the
weathertopic by callingsubscribeAndGetPublisherwith a proxy for theWeatherStationobject. - Unsubscribe from the
weathertopic by callingunsubscribewith the same proxy.
Subscriber Identity
IceStorm identifies each subscription to a topic by the object identity of the subscriber proxy. When the topic already has a subscription with this identity, subscribeAndGetPublisher throws AlreadySubscribed and keeps the existing subscription, including its proxy and quality of service parameters. To replace the stored proxy or the quality of service of a subscription, call unsubscribe and then subscribe again.