Diffusion 6.2.2 User Manual

Receiving data from topics

A client can subscribe to a topic to receive a stream of updates or
can fetch the current state of a topic.

Topics

A topic is a logical channel through which data can be distributed to clients. Topics
provide a logical link between publishing clients and subscribing clients.

Diffusion™ provides different types of topic that can be
used to stream diffent data formats or can be used for special purposes. For more
information about topic types and uses, see Topics.

Subscribing

To receive data published to a topic as a stream of updates, a client takes the
following actions:

Subscribe to a topic or set of topics.

Register a stream that matches the topic or set of topics, or register a
matching fallback stream.

For topics that exist and that the client is subscribed to, data is received
through a stream that is registered against that topic - if one exists and is of the
appropriate type.

Note: The subscription flow is fully described in the design section of the
documentation. For more information, see Subscribing to topics.

Fetching

To fetch the current value of a topic or set of topics, a client makes a fetch request, passing in a
fetch stream, and uses the fetch stream to receive the data.

Streams

Clients use streams to receive data from topics.Figure 1. A stream
Streams are API objects that can receive multiple calls from the Diffusion server on the same method while the stream is open. After
the stream is closed or discarded, it can no longer receive responses on any of its
other methods.

Subscribing to topics
Subscribe to topics with topic selectors. When topics exist that match the selections made by the client, data from those topics is sent to the client from the Diffusion server.

Using streams for subscription
Register a stream against a set of topics to access values published to those topics. For a registered stream to access the value of a topic, the topic type must match the stream and the client must be subscribed to the topic.

Fetching the current value of a topic
A client can send a fetch request for the values and/or topic specifications of a set of topics. The result set can be filtered by topic selector and topic path range.

Receiving topic notifications
Receive topic notifications using topic selectors. This enables a client to receive updates when topics are added or removed, without the topic values.