A topic is a character string that describes the nature of the data that is published in a publish/subscribe system.
Topics are key to the successful delivery of messages in a publish/subscribe system. Instead of including a specific destination address in each message, a publisher assigns a topic to the message. The message broker matches the topic with a list of clients (subscribers) who have subscribed to that topic, and delivers the message to each of those clients.
Note that a publisher can control which subscribers can receive a publication by choosing carefully the topic that is specified in the message.
Topics can be defined by a system administrator using the workbench. However, the topic of a message does not have to be defined before a publisher can use it; a topic can also be defined when it is specified in a publication for the first time.
More than one topic can be specified for a publication.
A topic string can include any character from the Unicode character set, including the space character. However, there are three characters that have special meanings. These characters ("/", "#", and "+") are described in Special characters in topics.
Although a null character does not cause an error, do not use null characters in your topic strings.
Each topic that you define is an element, or node, in the topic tree. The topic tree can either start empty or contain topics that have been defined by a system administrator using the workbench. You can define a new topic either by using the workbench or by specifying the topic for the first time in a publication.
Although you can construct a topic tree as a flat, linear structure, it is better to build a topic tree in a hierarchical structure with one or more root topics.
Each character string in the figure represents a node in the topic tree. A complete topic name is created by aggregating nodes from one or more levels in the topic tree. Levels are separated by the "/" character. The format of a fully specified topic name is: "root/level2/level3".
When you design topic names and topic trees, remember that the message broker does not interpret, or attempt to derive meaning from, the topic name itself. It uses the topic name only to send related messages to clients who have subscribed to that topic.
Notices |
Trademarks |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
aq01130_ |