Just a second...

Single value topics

A topic that streams data as a single value that can be constrained to a defined data type. Single value topics are stateful: their state is maintained on the Diffusion™ server.

The value of the topic state is stored as a string. However, the type of the single value can be constrained in certain ways, for example, to hold a string, an integer, or a decimal number. The type of the single value is described using field metadata in the schema. For more information, see Metadata.

Why use a single value topic?

For the majority of use cases, single value topics are the most appropriate model for your data. Single value topics are easy to create and update, and the data the topic contains is simpler.

If a structure is required for your data, you can use the design of your topic tree to define the structure.

Single value topics are supported by all client APIs.

By defining the type of the single value of the topic, you benefit from automatic validation and formatting of the data.

Considerations when using a single value topic

A single value topic can only hold textual data. This type of topic data cannot be used to publish non-textual data, such as a PDF or PNG file.

Single value topics cannot be used to make multiple updates transactionally. If you have multiple items of data that you want to publish at the same time and have received by subscribing clients at the same time, you cannot split these items of data across multiple single value topics. In this case, it is more appropriate to use a topic with a composite data type such as a JSON topic, CBOR topic, or record topic. A topic with a composite data type can contain fields for each of the data items.

If you use value streams to receive updates from a single value topic, this can cause problems in the event of client reconnection. We recommend that when using value streams, you configure your clients not to attempt to reconnect to a session, but instead to connect again with a new session and resubscribe to topics.