How does it work?
Publishers, subscribers, and brokers communicate with each other using command messages. These messages are used to do the following
things:
- Publisher and broker
- The following communications take place between publishers and brokers:
- A publisher can register its intention to publish information about certain
topics (this is optional: registration can take place with the first publication,
or not at all, as described in Registering with the broker).
- A publisher sends publication messages to the broker, containing the publication
data (or referring to it). The messages can be forwarded directly to the subscribers,
or, in the case of retained publications, be held at the broker until requested
by a subscriber.
- A publisher can send a message to the broker requesting that a retained
publication held at the broker be deleted.
- A publisher can deregister with the broker when it has finished sending
messages about a certain topic.
These interactions are all described in Writing publisher applications.
- Subscriber and broker
- The following communications take place between subscribers and brokers:
- A subscriber registers with a broker, specifying the topics that it is
interested in.
- The broker sends to the subscriber subsequent publications that match
the topics specified. Alternatively, the subscriber can request retained publications
held at the broker.
- The subscriber can deregister with the broker for certain topics when
it is no longer interested in them.
These interactions are all described in Writing subscriber applications.
- Broker and broker
- The following communications take place between brokers:
- Brokers can exchange subscription registrations and deregistrations.
- Brokers can exchange publications, and requests to delete publications.
- Brokers can exchange information about themselves.
These interactions are illustrated in Figure 3.