Publishing using stateless topics
Stateless topics are topics that have no associated current value in the Diffusion™ server. You can publish using a stateless topic in a simple way or as part of a complex action triggered by a client subscription to that topic.
Stateless topics have no associated topic data. These topics simply pass through any updates that are made to them to the subscribing clients.
Simple updates using a stateless topic
Use the publishMessage method on the topic to publish data using the stateless topic at any time. This data is not stored on the Diffusion server and is sent as-is to all current subscribers to the stateless topic.
topic.publishMessage(data);
On-subscription updates using a stateless topic
Stateless topics pass through data from the publisher to the subscribing clients. This published data can be a full update or a delta on previous updates. If a client subscribes to a stateless topic after a full update and before a delta, the client receives the delta, but does not have the base data to apply it to.
To ensure that a newly subscribing client receives a full update for that topic, the publisher subscription method — which is called every time a client subscribes to a topic managed by the publisher — can publish an update that contains all the data required by the subscriber to that topic. This data is not published until the client subscription to the topic is complete.
Using the subscription method can cause performance issues. For more information, see Handling client subscriptions.
@Override protected void subscription(final Client client, final Topic topic, final boolean loaded) throws APIException { // Do the required processing to create the full update message to // publish for the newly subscribed client. // Publish that message to the stateless topic topic.publishMessage(data); }
This page last modified: 2015/05/28