Receiving data from topics
A client can use the Topics feature to subscribe to a topic or to fetch the state of a topic.
Streams
Clients use streams registered against sets of topics to receive values published to those topics.
Streams are registered using topic selectors and can be registered multiple times with different selectors. If more than one of the topic selectors used to register a stream matches a topic, the stream receives each value for that topic only once.
Multiple streams can be registered against the same topic. All streams registered against the topic receive a value for it. The order that these streams receive the value is not defined.
Stream type | Description |
---|---|
Value stream | Value streams are typed. Register value streams against a set
of topics by using a topic selector. A value stream receives
updates for any subscribed topics that match the
value stream's type and the topic selectors used when
registering the value stream. If a value stream receives a delta update, this delta is automatically applied to a locally cached value so that the stream always receives full values. A value stream can have one of the following types:
Value streams are provided in the JavaScript®, Android™, and Java™ APIs. |
Topic stream | Topic streams are not typed and are used to receive value and
delta updates for all subscribed topics that match the topic
selectors used when registering the value stream. This type of
stream provides the value and the deltas but relies upon the
application to apply the deltas to a client maintained current
value. Where a value type is available for your topic, we recommend you use a value stream instead of a topic stream. |
Fetch stream | Fetch streams are not typed and are used to receive responses to fetch requests for all topics that match the topic selectors used when registering the value stream. |
You can register one or more fallback streams to receive updates to subscribed topics that do have a value stream or topic stream registered against them.
Subscribing to a topic
Required permissions:
and permissions for the specified topicA client can subscribe to a topic to receive updates that are published to the topic. If the topic has state, when the client subscribes to that topic it receives the topic state as a full value. Subsequent updates to the data on the topic can be received as delta update messages or as values depending on the type of the topic and the structure of its data.
Subscribing to multiple topics using a topic selector
Required permissions:
and permissions for the specified topicsA client can subscribe to multiple topics in a single request by using topic selectors. Topic selectors enable you to select whole branches of the topic tree or use regular expressions to select topics based on the names in the topic path.
For more information, see Topic selectors in the Unified API.
Fetching the state of a topic
Required permissions:
and permissions for the specified topicA client can send a fetch request for the state of a topic. If the topic is of a type that maintains its state, the Diffusion™ server provides the current state of that topic to the client.
This page last modified: 2015/02/02