1 2 Previous Next 22 Replies Latest reply on Apr 18, 2014 9:59 AM by jbertram

    Multiple DLQs in  HornetQ

    sankalp.madaan

      Hello everyone.

       

      I am using Hornetq in JBoss EAP6.1 environment. I have a topic and two MDBs(say A and B) listening to that topic. I have some questions regarding this:

      1. Can we configure multiple DLQs i.e. 1 DLQ for each MDB ? If yes how? 

      2. If no, then how can we determine that the undelivered message in DLQ belongs to which MDB i.e. which MDB was down that caused the message to go to DLQ?

       

      Hope I am clear with my questions. Please let me know if anything else I need to provide for clear answer.

       

      Thanks in advance

        • 1. Re: Multiple DLQs in  JBoss 6.1
          sankalp.madaan

          People, I know this is a very basic question but it will help us in preparing the architecture. Please help !!

          • 2. Re: Multiple DLQs in  HornetQ
            ulf.schroeter

            An MDB is just a normal JMS message consumer and I think there is NO possibility to direct undelivered messages for a single topic to different DLQ based on failed consumer. DLQ's are related to message adresses, but not to consuming MDB's. Chapter 21. Message Redelivery and Undelivered Messages

            • 3. Re: Multiple DLQs in  HornetQ
              jbertram

              Ulf is right.  DLQ configuration is tied to the address, not the consumer (e.g. an MDB). 

               

              However, I think you can get the behavior your after by using a divert to route the message to 2 different addresses (each with its own DLQ) and then have each MDB consume from the appropriate address.

              1 of 1 people found this helpful
              • 4. Re: Multiple DLQs in  HornetQ
                ulf.schroeter

                Right, but then most probably an additional DLQ per individual address (=individual consumer MDB) seems to be needless. If a specific MDB is down messages simply could stay within individual address without need to send it to DLQ. This would also simplify message recovery after MDB restart.

                 

                Nevertheless  the overall planned usage approach of an additional DLQ for monitoring proper MDB activity (at least this is my assumption what you want to achieve) seems to be somehow wrong to me. Instead either you should monitor steadily increasing message count within individual address proposed by Justin as indicator for MDB failure or use any other application server management api for controlling MDB state.

                • 5. Re: Multiple DLQs in  HornetQ
                  jbertram

                  To your point, a DLQ is message-centric, not consumer-centric.  It's a mechanism to deal with messages that are not processed properly regardless of the underlying problem.  It is not meant to identify a particular consumer or provide details about the nature of the failure.

                  • 6. Re: Multiple DLQs in  HornetQ
                    sankalp.madaan

                    Yes Justin, you are right. Actually in my case MDB is never down. It is calling a web service and on the basis of response I am getting,  I am deliberately making the transaction rollbacked.

                     

                    However, I think you can get the behavior your after by using a divert to route the message to 2 different addresses (each with its own DLQ) and then have each MDB consume from the appropriate address.

                     

                    Can you tell the way to do that? I think this will solve my problem. What do you mean by saying 2 different addresses? 2 different topics(or queues)?

                    • 7. Re: Multiple DLQs in  HornetQ
                      sankalp.madaan

                      Sorry Ulf for being not clear in my query. Actually my MDB is never down. In MDB, I am sending the message to some outside party using a web service and on the basis of response I am getting, I am doing rollback for the transaction. The problem I am facing is that, I am not able to determine which message got undelivered for which MDB in DLQ, so that I can reprocess accordingly. So i am looking for a way for having 1 DLQ per address.

                      • 8. Re: Multiple DLQs in  HornetQ
                        jbertram

                        Actually I think you can get what you need simply by looking at the String property "_HQ_ORIG_ADDRESS" on the messages in the DLQ.  That property indicates to what address the message was originally sent.

                        1 of 1 people found this helpful
                        • 9. Re: Multiple DLQs in  HornetQ
                          jbertram

                          BTW, this is documented here.

                          • 10. Re: Multiple DLQs in  HornetQ
                            sankalp.madaan

                            Thanks Justin. Last 1 query. What does this original address refer to? Address of Topic or address of subscriber? If it is address of subscriber, is it similar to client ID or different?

                            • 11. Re: Multiple DLQs in  HornetQ
                              jbertram

                              I'm not exactly sure what you mean by, "Address of Topic or address of subscriber."

                               

                              The property refers the the address where the message was originally sent.  Since multiple addresses can route to the same DLQ this property can be used to identify where the message was originally sent so it can be dealt with appropriately.

                               

                              It has nothing to do with client ID.

                              • 12. Re: Multiple DLQs in  HornetQ
                                sankalp.madaan

                                Thanks Justin. I will try out this now. Thanks for helping.

                                • 13. Re: Multiple DLQs in  HornetQ
                                  sankalp.madaan

                                  I tried this property Justin. It gave me the name of the Topic to which the message was originally destined. But I want to know from which subscriber it failed. Can you advise any method?

                                  • 14. Re: Multiple DLQs in  HornetQ
                                    jbertram

                                    Look at the name of the subscription to which the message was sent (i.e. the "_HQ_ORIG_QUEUE" property).  That might help you determine what subscriber failed because each subscriber gets their own subscription (i.e. queue).

                                     

                                    However, as I indicated previously in this thread, "[a DLQ] is not meant to identify a particular consumer or provide details about the nature of the failure."

                                    1 2 Previous Next