Publications

A publication is a piece of information about a specified topic that is available to a pub/sub broker in a publish/subscribe system. The pub/sub broker can be an MQ broker (queue manager) or an MQTT broker.

Typically, a pub/sub broker distributes a publication that it receives to all applications that have registered a subscription for the publication. If the pub/sub broker is an MQ broker (queue manager), it also distributes the publication to all other queue managers connected to it, either directly or through a network of queue managers that have subscribers for the publication.

Local publications

If your application uses an MQ pub/sub broker, publishers can restrict access to their publications to only those subscribers that are registered to the same pub/sub broker as the publisher. This publication is known as a local publication.

If you are using an MQTT broker, all publications are local. Local publications are not forwarded to other pub/sub brokers.

Global publications

A publication whose distribution is not restricted to subscribers that are registered to the same pub/sub broker as the publisher is known as global publication. Global publications can be published through MQ pub/sub brokers (queue managers) only. A global publication is forwarded to all MQ pub/sub brokers, connected either directly or through a network of queue managers, that have one or more subscribers for the publication.

State and event information

Information being published can be categorized either as state information or as event information.

State information is information about the current state of something. The current price of stock or the current score in a soccer match are both examples of state information.

Event information is information about an individual event that occurs. A change in the price of stock or the scoring of a particular goal in a soccer match are both examples of event information.

When an event occurs, the current state information is no longer required and is superseded by new state information.

If a publication contains state information, it is often published as a retained publication. A new subscriber typically wants the current information immediately; the subscriber does not want to wait for an event that causes the information to be republished.

Retained publications

Typically, a pub/sub broker discards a publication after it has been delivered to subscribers. However, a publisher can specify (in the case of the Publish message, by specifying the RetainPub option) that it wants the pub/sub broker to keep a copy of the publication, which is then called a retained publication.

If a retained publication has been published, new subscribers to that publication receive the publication without having to wait for it to be published again.

For example, a subscriber that registers a subscription for a stock price receives the latest published stock price immediately, and does not have to wait for the stock price to be republished.

An MQTT pub/sub broker retains only one publication for each topic. An MQ pub/sub broker retains only one publication for each combination of topic and subscription point.