4 Replies Latest reply on Sep 23, 2011 12:15 AM by phoncy

    JMS: Long delay in the invocation of onMessage() method

    phoncy

        I'm using jboss messaging in my application. I have configured a queue in destinations-service.xml as below:

       

       

      <mbean code="org.jboss.jms.server.destination.QueueService"

      name="jboss.messaging.destination:service=Queue,name=MailQueue"

      xmbean-dd="xmdesc/Queue-xmbean.xml">

      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>

      <depends>jboss.messaging:service=PostOffice</depends>

      <attribute name="JNDIName">queue/MailQueue</attribute>

      <attribute name="RedeliveryDelay">3000</attribute>

      <attribute name="MaxDeliveryAttempts">3</attribute>

      </mbean>

       

       

      The message appears in the queue immediately after it has been sent. But the onMessage() method is not getting invoked immediately. The method is getting called after a delay of few hours. The jboss version is 5.1.0.GA. Please help me to resolve this issue.

       

       

      Thanks in advance.

       

        

        • 1. Re: JMS: Long delay in the invocation of onMessage() method
          mp911de

          Hi Joseph,

          you run 5.1.0 in Stand-Alone and do not use persistence for the Queues (Messages are stored in the Database)? Do you use just a Queue-Listener or do you use a Message-Driven bean? And are there only a few messages or is there a heavy load on the Queue?

           

          Usually, when you use MDB's, there should be a delay of only a few msec's until onMessage is called.

           

          Best regards,

          Mark

          • 2. Re: JMS: Long delay in the invocation of onMessage() method
            phoncy

            Hi Mark,

             

              Thanks for the reply. I have not configured any database for persistence. So I assume that by default the hsqldb in jboss will be used for persistence. I'm using a Queue-Listener for receiving the messages. I have been testing the queue with 3-4 messages, so there is not much load on it.

             

             

            Regards

            Phoncy

            • 3. Re: JMS: Long delay in the invocation of onMessage() method
              mp911de

              Hi Phoncy,

              so it looks like you use the JBoss defaults. That's ok. Have you tried to put a (empty, only some logging) MessageDriven-Bean on your Queue just to check that the behavior is the same?

               

              Long delays of that sort occour mostly on networking issues, when some hosts are tried to be reached but the connect's run into timeouts. To assure this, you could simply run JBoss on your local machine without having a network connection. Have you also tried to use a mini-client that handles only writing into the queue and on the other side having a listener? For that case you would not need any deployed apps on your JBoss, only that test-app.

               

              Best regards,

              Mark

              1 of 1 people found this helpful
              • 4. Re: JMS: Long delay in the invocation of onMessage() method
                phoncy

                Hi Mark,

                  

                     The delay was occuring due to network connection. It worked fast when I deployed it in a different server. Thanks for the guidance.

                 

                Regards

                Phoncy.