WebSphere Message Brokers
File: aq13030_
Writer: Terry Cowling

Task topic

This build: July 31, 2007 21:35:27

Using retained publications

By default, a broker discards a publication after it has sent that publication to all interested subscribers. However, a publisher can specify that it wants the broker to keep a copy of a publication, which is then called a retained publication.

A copy of a retained publication is sent by the broker to all subscribers who register an interest in the topic of the publication. This means that a new subscriber does not have to wait for information to be published again before they receive it.

For example, a subscriber that registers a subscription to a stock price receives the most recently published price straightaway, without having to wait for the stock price to change and be republished.

If RetainPub is specified as a publication option in the Publish message, the publication is retained by the broker and replaces any previously retained publication for that topic.

Because the broker retains only one publication for each topic and subscription point, the old publication is deleted when a new publication arrives.

When deciding whether to use retained publications, consider the following questions.

Use the Expiry field of the message descriptor (MQMD) to set an expiry interval for a retained publication.

The sample verification applications that are shipped with WebSphere Message Broker include the Soccer Results sample. This sample uses retained publications to record the latest score in each soccer match that it is monitoring. The sample code illustrates the programming that is required to support this option. You can view samples only when you use the information center that is integrated with the Message Brokers Toolkit.

Not all applications can publish retained publications, and not all retained publications can have expiry dates applied to them. The following table shows which applications can publish retained publications and whether the retained publications can have an expiry date:
  MQ SCADA JMS/IP
Retained YES YES NO
Expiry Date YES NO NO

The columns in the table indicate three types of application. The first row indicates whether a publication can be a retained publication, and the second row indicates whether an expiry date can be applied to the publication.

Related concepts
Publications
Subscriptions
Related tasks
Publishing
Subscribing
Deregistering a subscription
Related reference
Publish message
Register Subscriber message
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2007Copyright IBM Corporation 1999, 2007. All Rights Reserved.
This build: July 31, 2007 21:35:27

aq13030_ This topic's URL is: