+

Search Tips   |   Advanced Search

Use durable subscriptions

You use durable subscriptions for publish/subscribe messaging. A durable subscription can be used to preserve messages published on a topic while the subscriber is not active.

If there is no active subscriber for a durable subscription, JMS retains the subscription messages until they are received by the subscriber, or until they expire, or until the durable subscription is deleted. This enables subscriber applications to operate disconnected from the JMS provider for periods of time, and then reconnect to the provider and process messages that were published during their absence.

Each JMS durable subscription is identified by a subscription name (subName), which is defined when the durable subscription is created. A JMS connection also has an associated client identifier (clientID), which is used to associate a connection and its objects with the list of messages (on the durable subscription) that is maintained by the JMS provider for the client. The subName assigned to a durable subscription must be unique within a given client ID.

If an application needs to receive messages published on a topic while the subscriber is inactive, it uses a durable subscriber.

In normal operation there can be at most one active (connected) subscriber for a durable subscription at a time. However, when running inside an application server it is possible to clone the application server for failover and load-balancing purposes. In this case, a cloned durable subscription can have multiple simultaneous consumers.

For information about durable subscriptions, see the JMS 1.1 Specification (for example, section 9.3.3 "Using Durable Subscriptions").

The following operations for durable subscriptions are in addition to the usual JMS operations, such as to first look up a connection factory and a JMS destination, and to create a connection and session.

The following are the main operations for using durable subscriptions:


Related concepts

  • Workload sharing with publish/subscribe messaging