Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of 'durable' attribute for JMS Queue in JBoss 7 with HornetQ?

During configuration of JMS queues on JBoss 7 with HornetQ (based on standalone-full.xml configuration) I noticed an attribute 'durable'.

enter image description here

I browsed several sources and many of them stated queues are always 'durable', meaning the message will be always delivered, even in case of potential receivers being inactive at the time of send.

Does this attribute in JBoss 7 HornetQ refer to temporary queues? Or does this attribute refer to some kind of non-temporary non-durable queues?

like image 521
acalypso Avatar asked Dec 11 '12 08:12

acalypso


People also ask

What is durable queue in JMS?

FAQ > JMS > How do durable queues and topics work. Durable queues keep messages around persistently for any suitable consumer to consume them. Durable queues do not need to concern themselves with which consumer is going to consume the messages at some point in the future.

What happens when JMS queue is full?

When the queue fills, nothing can put new messages to it. In WebSphere MQ the producing application then receives a return code indicating that the queue is full. If the application distinguishes between fatal and transient errors, it can stop and retry.

What is the difference between JMS queue and Topic?

A JMS destination is an object (a JMS queue or a JMS topic) that represents the target of messages that the client produces and the source of messages that the client consumes. In point-to-point messaging, destinations represent queues; in publish/subscribe messaging, destinations represent topics.

How does JMS queue work?

JMS supports two different message delivery models: Point-to-Point (Queue destination): In this model, a message is delivered from a producer to one consumer. The messages are delivered to the destination, which is a queue, and then delivered to one of the consumers registered for the queue.


2 Answers

I feel the word "Durable" is more applicable to Topics than queues. A durable subscription is one where the publications for a subscriber are stored by the messaging provider when that subscriber is not running. Once the subscriber becomes active, these stored messages will be delivered to that subscriber. For non-Durable subscribers will not receive any publications if they are not active.

With respect to Queues, the messages are held in the queue till someone receives them or they expire. The messages can be persistent meaning they will survive restart of messaging provider and non-persistent where the messages are lost when messaging provider goes down.

like image 57
Shashi Avatar answered Sep 24 '22 17:09

Shashi


After brief investigation I came up with a few conclusions. All observations are based on JBoss 7.1.1.Final with HornetQ Server 2.2.13.Final.

  • The non-durable queue is not a temporary queue. It exists until it's manually deleted.

  • All the messages submitted to non-durable queue vanish upon JMS provider restart/failure (delivery modes, i.e. PERSISTENT / NON_PERSISTENT of the submitted messages are ignored).

  • The value of JMSDeliveryMode header element of the messages is not modified. In particular, if the message was submitted with PERSISTENT delivery mode to a non-durable queue, the flag is set to PERSISTENT, even though the non-durable queue does not persist the message (it is lost in case of JMS provider restart/failure).

From the client side it seems to be a bit of a disturbing prospect, since the sender has potentially no way of knowing whether the declared delivery mode of the message will not be respected, due to the problematic meaning of 'non-durable' queue.

Furthermore, the term 'durable queue' in this context seems disjointed from the 'durable subscription', as it does not appear to affect delivery of messages to inactive consumers in any way.

like image 23
acalypso Avatar answered Sep 20 '22 17:09

acalypso