Skip to content

Instantly share code, notes, and snippets.

@bsnyder
Last active October 10, 2015 21:07
Show Gist options
  • Save bsnyder/3750515 to your computer and use it in GitHub Desktop.
Save bsnyder/3750515 to your computer and use it in GitHub Desktop.
DISTINGUISHING JMS MESSAGE DURABILITY FROM MESSAGE PERSISTENCE
DISTINGUISHING MESSAGE DURABILITY FROM MESSAGE PERSISTENCE
Two points within JMS that are often confused are message durability and message persistence. Though they’re similar, there are some semantic differences between them and each has its specific purpose. Message durability can only be achieved with the pub/sub domain. When clients connect to a topic, they can do so using a durable or a nondurable subscription. Consider the differences between the two:
* Durable subscription—A durable subscription is infinite. It’s registered with the topic subscription to tell the JMS provider to preserve the subscription state in the event that the subscriber disconnects. If a durable subscriber disconnects, the JMS provider will hold all messages until that subscriber connects again or
until the subscriber explicitly unsubscribes from the topic.
* Nondurable subscription—A nondurable subscription is finite. It’s registered with
the topic subscription to tell the JMS provider to not preserve the subscription state in the event that the subscriber disconnects. If a subscriber disconnects, the JMS provider won’t hold any messages during the disconnection period.
Message persistence is independent of the message domain. Message persistence is a quality of service property used to indicate the JMS application’s ability to handle missing messages in the event of a JMS provider failure. As discussed previously, this quality of service is specified on the message producer’s setDeliveryMode method using one of the JMSDeliveryMode class’s PERSISTENT or NON-PERSISTENT properties as an argument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment