Publish / Subscribe Using DataStreams and DataGroups
Publish / Subscribe is one of several messaging paradigms supported by Universal Messaging. Universal Messaging DataGroups are lightweight structures designed to facilitate Publish/Subscribe . When using DataGroups, user subscriptions are managed remotely in a way that is transparent to subscribers. Universal Messaging Channels provide an alternative style of Publish/Subscribe where the subscribers manage their subscriptions directly.
There are two resources that are used when interacting with DataGroups: DataStreams and DataGroups.
A Data Stream is a destination for published events. Publishers with appropriate permissions can write events directly to Data Streams. A Universal Messaging client session can optionally have a Data Stream, and receive events through it.
A Data Stream can be a member of one or more Data Groups.
Any event written to a Data Group will be propagated to all Data Streams that are members of that Data Group.
Data Groups may also contain other Data Groups. Any event written to an upper level Data Group will be written to all contained Data Groups, and thus to all contained Data Streams.
Note that all Data Streams are automatically added to the realm server's Default Data Group. Writing an event to the Default Data Group, therefore, will ensure it is delivered to any client with a session configured to use a Data Stream.
This section demonstrates Universal Messaging pub / sub using DataGroups in C++, and provides example code snippets for all relevant concepts.