3 Replies Latest reply on Oct 15, 2013 1:23 PM by Israel E. Bethencourt

    Detect MDB connection failure

    seacuke23 Newbie

      We have a requirement to make the application aware that an MDB within the application is failing to connect.  The MDB will be driven by a HornetQ queue on a separate server.  I have seen that the ClientSession class from the HornetQ API has a addFailureListener(SessionFailureListener listener) function, but I presume I'll never be able to access the session directly.  Is there any other way for me to detect that this MDB is not receiving messages because it is looping reconnecting?

        • 1. Re: Detect MDB connection failure
          Israel E. Bethencourt Newbie

          Hello,

           

          I'm using Jboss6 and I've noted also some issues using MDB's and even configuring the HornetQRAManagedConnectionFactory to try to connect indefinitely to a remote queue sometimes it doesn't connect I don't know exactly why.

          What I doing to detect any problem with this is to count how many consumers has the queue. If there are no consumers on a queue I will be notified because it's sure there is something wrong. To do this I'm using twiddle (the jmx command line) with some scripts to integrate it with nagios.

           

          If you want more details about this, please comment.

           

          Greetings.

          1 of 1 people found this helpful
          • 2. Re: Detect MDB connection failure
            seacuke23 Newbie

            Thanks for your response.

             

            I was looking more specifically for a way to track the connection failures from within the app itself so the app could be aware of the failures.  We need the app to change its behaviour if it's not going to be able to receive notifications.  I suppose we can take this approach then communicate with the app from the external monitoring script via webservice or something.

            • 3. Re: Detect MDB connection failure
              Israel E. Bethencourt Newbie

              Hi,

               

              Yes, I know what you mean. But I haven't found a method to receive connection errors from MDB's. I was waiting to port my application to JBoss7 (I'm still using jboss6) to check if there are a solution for that situation. On the other side I have a standalone application using JMS api to consume messages from a queue and I'm using the exception listener to detect connection failures, works like a charm but you can not use it on MDB's.

               

              The solution you propose is what I'm doing with nagios right now. But I don't need to change so much the behavior of the application if a connection failure is detected, simply notify.

              Greetings.