Publishing data
Consider the following information when deciding how to publish data to topics.
Data type
The updates that you publish to a topic must have a data type and format that matches the data type of the topic.
For example, if your topic is a single value topic where the data is of type integer, all updates published to the topic must contain a single piece of integer data.
Similarly, if your topic is a record topic with a metadata structure defined, all updates published to the topic must have the same metadata structure.
Update size
When considering the format of your data, be aware that the maximum size for a topic update or a message sent through Diffusion™ Cloud is 1 MiB.
Update modes
There are two modes of updating topics:-
Update Streams
This is the preferred mode of updating. An update stream is created for each topic to be updated. The stream caches the last value and sends only changes (deltas) to the server to update the topic. This minimises the amount of data sent.
Delta streaming can optionally be disabled. Disabling delta compression can reduce the CPU workload at the client at the cost of increased bandwidth and possible additional CPU load on the server (if the topic publishes deltas). This may be particularly useful for topics that have PUBLISH_VALUES_ONLY set.
Certain constraints may be applied to the streams and locks can be used; to prevent two clients updating the same topic at the same time.
Single Updates
A single update can be sent to update a topic at any time. In this mode, there are no constraints and clients risk their updates being overwritten by updates from other clients; or that updates from multiple clients are published in a different order than intended. Values are not cached so the full value must be sent to the server on each update.
In either mode there is the option to automatically create the topic if it does not already exist.
For more information see Updating topics
Dynamically adding topics
A publishing client can create topics dynamically as and when the topics are required. For example, in response to a subscription request from another client for a non-existent topic.
For more information, see Handling subscriptions to missing topics .
Security
To publish data to a topic, a client must have the
permission for that topic.For more information, see Permissions.