2 Replies Latest reply on Dec 21, 2007 11:04 AM by Adrian Brock

    Higher JMSPriority not stepping in front of lower JMSPriorit

    CTO SEOENG Newbie

      Below is my invoker-proxy-binding and container-configuration for this specific MDB (Bean-Managed). Here is the use case:

      1. Send JMS Message with JMSPriority 4 to Queue
      2. Send JMS Message with JMSPriority 4 to Queue
      3. Send JMS Message with JMSPriority 7 to Queue

      The MDB (Bean-Managed) is processing as follows:

      1. Receives JMS Message #1, starts processing
      2. Receives JMS Message #2, starts processing
      3. Receives JMS Message #3, starts processing

      NOTE: All messages are queued before MDB finishes #1.

      What behavior is expected:

      1. Receives JMS Message #1, starts processing
      2. Receives JMS Message #3, starts processing
      3. Receives JMS Message #2, starts processing

      Because Message #3 enters the Queue before Message #1 is finished processing in MDB, shouldn't Message #3 be consumed by the MDB next?

       <invoker-proxy-binding>
       <name>message-driven-bean</name>
       <invoker-mbean>default</invoker-mbean>
       <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
       <proxy-factory-config>
       <JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>
       <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
       <CreateJBossMQDestination>true</CreateJBossMQDestination>
       <!-- WARN: Don't set this to zero until a bug in the pooled executor is fixed -->
       <MinimumSize>1</MinimumSize>
       <MaximumSize>1</MaximumSize>
       <KeepAliveMillis>30000</KeepAliveMillis>
       <MaxMessages>1</MaxMessages>
       <MDBConfig>
       <ReconnectIntervalSec>10</ReconnectIntervalSec>
       <DLQConfig>
       <DestinationQueue>queue/DLQ</DestinationQueue>
       <MaxTimesRedelivered>10</MaxTimesRedelivered>
       <TimeToLive>0</TimeToLive>
       </DLQConfig>
       </MDBConfig>
       </proxy-factory-config>
       </invoker-proxy-binding>
      
       <container-configuration>
       <container-name>MDBConfig</container-name>
       <call-logging>false</call-logging>
       <invoker-proxy-binding-name>website-crawler-message-driven-bean</invoker-proxy-binding-name>
       <container-interceptors>
       <interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
       <interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
       <interceptor>org.jboss.ejb.plugins.RunAsSecurityInterceptor</interceptor>
       <!-- CMT -->
       <interceptor transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
       <interceptor transaction="Container">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
       <interceptor transaction="Container">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
       <!-- BMT -->
       <interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
       <interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT</interceptor>
       <interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
       <interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
       </container-interceptors>
       <instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
       <instance-cache></instance-cache>
       <persistence-manager></persistence-manager>
       <container-pool-conf>
       <MaximumSize>1</MaximumSize>
       </container-pool-conf>
       </container-configuration>
      


        • 1. Re: Higher JMSPriority not stepping in front of lower JMSPri
          CTO SEOENG Newbie

          Ok, I think I have figured out what JBoss is doing. I am using 4.2.2GA.

          Here is the new use case I used:

          1. Send JMS Message with JMSPriority 4 to Queue
          2. Send JMS Message with JMSPriority 4 to Queue
          3. Send JMS Message with JMSPriority 4 to Queue
          4. Send JMS Message with JMSPriority 7 to Queue

          The MDB (Bean-Managed) is processing as follows:

          1. Receives JMS Message #1, starts processing
          2. Receives JMS Message #2, starts processing
          3. Receives JMS Message #4, starts processing
          4. Receives JMS Message #3, starts processing

          NOTE: All messages are queued before MDB finishes #1.

          What behavior is expected:

          1. Receives JMS Message #1, starts processing
          2. Receives JMS Message #4, starts processing
          3. Receives JMS Message #2, starts processing
          4. Receives JMS Message #3, starts processing

          It appears that JBoss is queuing up a message before the MDB even processes it. So a higher priority message must wait what appears to be the invoker-proxy-binding's # of messages before it jumps in front.

          This doesn't make sense to me, wouldn't you want a higher priority message to jump in front immediately? Is there a way around this, i.e. am I not setting the configuration correctly for my desired result?

          • 2. Re: Higher JMSPriority not stepping in front of lower JMSPri
            Adrian Brock Master

             


            It appears that JBoss is queuing up a message before the MDB even processes it. So a higher priority message must wait what appears to be the invoker-proxy-binding's <MaximumSize> # of messages before it jumps in front.


            Correct. It's called read ahead. It would be very inefficient (latency) to wait
            until a message listener completes its onMessage() before
            retrieving the next message to process from the server.

            It's not configurable in JBossMQ, try JBoss Messaging
            or submit a patch to make it configurable (there's an old feature request
            about it somewhere but it was closed when we stopped developing JBossMQ).