Just a second...

Updating topics

A client can use the TopicUpdate feature to update topics.

Note: The TopicUpdate feature introduced in Diffusion™ 6.2 replaces the TopicUpdateControl feature which used exclusive and non-exclusive updaters, and is now deprecated.
A session can update a topic in one of the following ways:
Stateless set

Stateless set is a simple way to update the value of a topic.

The client does not retain any state information about the topic, meaning that delta streaming is not possible. If a session is expected to send frequent updates to a topic, consider using an update stream instead of stateless set.

Optimistic update streams

The TopicUpdate feature supports optimistic, non-exclusive update streams.

This stream type can use delta streaming like an exclusive updater, but does not prevent other sessions from updating the topic. It can detect when it no longer knows the latest value of the topic.

In addition, you can use the addAndSet method, which updates a specified topic if it is present, and creates and updates it if it is not present. This can be used statelessly or using an update stream.

Conditional updates

Both stateless set and optimistic update streams support conditional updates.

Conditional updates enable a client to apply a constraint to a topic update. The topic is only updated if the constraint is satisfied (as evaluated on the Diffusion server).

Constraints can check the existence of the topic, the current value of the topic, or the existence of a session lock.

You can use conditional updates to enable coordination between sessions.

If your application requires that a particular session has exclusive access to a topic, you can achieve this by making updates conditional on having a session lock on the topic.

Updating a topic with stateless set

Required permissions: update_topic

The set method replaces the current topic value with a new value.

Stateless set requires the following parameters:

The type of the value.

Topic path

The path of the topic.


The new value of the topic.

The primitive topic types (int64, double and string) support being set to null, but other types must be set to a value.
Note: From 6.2, if a primitive topic is set to null, new subscribers are not notified of the topic value until it changes to a non-null value.

The type of the topic being updated must match the type of value it is being set to.

Updating a topic with an optimistic non-exclusive updater

Required permissions: update_topic

To create an optimistic, non-exclusive update stream, a session must specify:

The type of the value.

Topic path

The path of the topic.

The update stream is created immediately without interacting with the server.

  1. The stream can be updated with either set or addAndSet.
  2. On the first update operation, the stream is validated with the server. From then on, the stream can detect if there are any changes to the topic it is updating.
  3. If another session changes the topic, the update stream is invalidated and will stop accepting new values. Only one update stream at a time can be valid. Once a stream is invalidated, any attempt to use it results in an InvalidUpdateStreamException.
  4. The validate method validates the stream with the server without setting a new value.