Explain the durable subscription in JMS.

Answered

Explain the durable subscription in JMS.

Ninja Asked on 19th September 2018 in JMS.
Add Comment
1 Answer(s)
Best answer

A nondurable subscriber can receive only messages that are published while it is active. A durable subscriber can receive messages that were sent when they were not active. Durable subscribers are created using Session.createDurableSubscriber method. A durable subscription can have only one active subscriber at a time.

A durable subscriber registers a durable subscription by specifying a unique identity that is retained by the JMS provider. If a durable subscription has no active subscriber, the JMS provider retains the subscription’s messages until they are received by the subscription or until they expire.

The unique identity of a durable subscriber can be set with the following:

  • A client ID for the connection
  • A topic and a subscription name for the subscriber

The client ID can be set administratively for a client-specific connection factory using either the command line or the Administration Console. The JMS provider stores the messages sent or published to the topic, as it would store messages sent to a queue. If the program or another application calls createDurableSubscriber using the same connection factory and its client ID, the same topic, and the same subscription name, then the subscription is reactivated and the JMS provider delivers any messages that were published while the subscriber was inactive.

Ninja Answered on 19th September 2018.
Add Comment