12 Replies Latest reply on Sep 15, 2011 4:38 PM by Bhupesh Bansal

    Clarification on Durable messages for Topics

    Billy Sjöberg Newbie

      Hi guys,

       

      Going over the HornetQ manual I fail to understand the section regarding durable subscribers.

       

      "

      11.1.18. Durable Subscription

       

      The durable-subscription example shows you how to use a durable subscription with HornetQ. Durable subscriptions are a standard part of JMS, please consult the JMS 1.1 specification for full details.

       

      Unlike non-durable subscriptions, the key function of durable subscriptions is that the messages contained in them persist longer than the lifetime of the subscriber - i.e. they will accumulate messages sent to the topic even if there is no active subscriber on them. They will also survive server restarts or crashes. Note that for the messages to be persisted, the messages sent to them must be marked as durable messages.

      "

       

      I have set up a test where I have a publisher A (actually a JBoss ESB flow) sending messages to a topic. Another flow (B) uses a durable subscription against that topic. The JMX console now shows that I have one Durable subscription against this topic.

       

      Once I send a message the JMX console tells me that I have one NonDurableMessageCount and zero DurableMessageCount's.

      I performed a test where:

       

      - I undeployed the subscriber B

      - Sent a message to the Topic.

      - Once the message was sent I restarted my AS.

      - Deployed subscriber B

       

      In contrary to the documentation the subscriber received the message even though it clearly was a NonDurable message.

      Can I guarantee that subscriber B will receive messages even though he was out when the messages are NonDurable?

       

      If not, does anyone have experience with JBoss ESB and how to send durable messages?