7 Replies Latest reply on Feb 16, 2010 9:10 AM by timfox

    dead letter and topics

    yairogen

      How does the dead letter queue concept work with topics?

       

      1. If I have multiple subscribers and some are not listening at the moment - will they get the messages when they start?

      2. If a consumer threw an exception - will this cause the topic to stay in the queue and after x retries be sent to the dead letter queue?

      3. If a topic has no subscribers will it stay there for ever?

       

      Please advise?

        • 1. Re: dead letter and topics
          ataylor
          Actually it is a dead letter address not a queue. Internall HornetQ has no notion of queues. A Topic is just an address where each subscriber has its own queue bound to that address. So if there are no subscribers the message will not be routed any where and will in effect just disappear. If there are 2 subcribers then there will be 2 queues bound to the address, each will handle redelivery of the message and forward it to the dead letter address after n tries, and tes if the client throws an exception the message will be redelivered
          1 of 1 people found this helpful
          • 2. Re: dead letter and topics
            yairogen

            Let me make sure I got this right:

             

            If I have 5 subscribers and a durable Topic.

             

            If user sends a message to the topic.

             

            If only 4 subscribers are up - one of them will lose his message. correct?

             

            If one of the 4 throws an exception, after n retries it will go to the DLQ. correct?

             

            if 2 subscribers throw an exception than I will see 2 identical messages in the DLQ. correct?

             

            If all the subscribers are down - what will happen to the message sent? It will disappear?

             

            Thanks.

            • 3. Re: dead letter and topics
              ataylor

              Well firstly this all depends on on whether your subscribers are durable or not. I would suggest reading a JMS tutorial, the Sun one is good.

               

              Think of a topic as an address where each subscription has its own queue and handles its one copy of a message (actually we only we keep one copy and use references), if a message is redelivered n times by the queue it will be sent to the DLA (dead letter address) so yes if 2 subscribers throw an exception there will be 2 messages routed to the DLA (actually its 2 references to the same message). If there are no subscriptions there is no where for the message to be routed too.

               

              Hope that makes sense

              • 4. Re: dead letter and topics
                timfox

                There is also a flag you can set on the address settings: send-to-dla-on-no-route

                 

                If true and message is not routed anywhere it will be routed to the dla

                 

                http://hornetq.sourceforge.net/docs/hornetq-2.0.0.GA/user-manual/en/html/queue-attributes.html#queue-attributes.address-settings

                1 of 1 people found this helpful
                • 5. Re: dead letter and topics
                  yairogen
                  Still not clear to me what will happen if one subscriber will start after message was sent - he will never get that message, right?
                  • 6. Re: dead letter and topics
                    ataylor
                    If the subscriber is non durable then no, it wont receive the message. Like i said before there are plenty of good tutorials that explain this stuff in detail.
                    • 7. Re: dead letter and topics
                      timfox

                      ataylor wrote:

                       

                      ... there are plenty of good tutorials that explain this stuff in detail.

                      http://java.sun.com/products/jms/tutorial/1_3_1-fcs/doc/advanced.html#1024758