1 Reply Latest reply on May 16, 2007 12:36 PM by Adrian Brock

    Multiple innvocation for single object(Message) in Queue

    Vijay Pillai Newbie

      Hi Guyz,

      I have a MDB running in two machines A and B, Queue is common for both MDB's.
      Queue is residing on Machine A.

      I posted 5 Objects(message) (eg. Obj1, Obj2, Obj3...Obj5) from Java client to Queue.

      The onMessage part is designed to consume 2minutes for execution.

      Both MDB's are consuming messages parallel, but the consumed Objects(messages) is repeatedly picked up for execution by MDB's even after completion of the consumed message.

      Pls suggest the working pattern of the MDB message handling.

      Jboss Version 4.0.3.

      public void onMessage(Message msg){
      System.out.println("OnMessage is called............."+getTime());
      String countId="";
      try
      {
      ObjectMessage objMsg = (ObjectMessage)msg;
      Count objCount = (Count)objMsg.getObject();
      countId=objCount.getOrderNumber();
      System.out.println("Message Received***********:"+countId);

      for (int i=0;i<5000;i++ ) {
      for (int j=0;j<9999999;j++ ) {
      ;
      }
      }
      }
      catch (Exception e)
      {
      e.printStackTrace();
      }
      System.out.println("OnMessage is End process........."+getTime()+"*******"+countId);
      }

      Jboss.xml
      -----------

      <enterprise-beans>

      <message-driven>
      <ejb-name>TestMDB</ejb-name>
      <configuration-name>TestMDB</configuration-name>
      <message-driven-destination>javax.jms.Queue</message-driven-destination>
      <destination-jndi-name>queue/CountTestQueue</destination-jndi-name>
      </message-driven>
      </enterprise-beans>

      <container-configurations>

      <!-- Configurations for async count MDBs -->
      <container-configuration>
      <container-name>TestMDB</container-name>
      <call-logging>false</call-logging>
      <container-invoker>org.jboss.ejb.plugins.jms.JMSContainerInvoker</container-invoker>
      <container-interceptors>
      org.jboss.ejb.plugins.LogInterceptor
      org.jboss.ejb.plugins.SecurityInterceptor
      <!-- CMT -->
      org.jboss.ejb.plugins.TxInterceptorCMT
      org.jboss.ejb.plugins.MetricsInterceptor
      org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor
      <!-- BMT -->
      org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor
      org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT
      org.jboss.ejb.plugins.MetricsInterceptor
      </container-interceptors>
      <instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
      <instance-cache/>
      <persistence-manager/>
      <transaction-manager>org.jboss.tm.TxManager</transaction-manager>
      <container-invoker-conf>
      <!-- RemoteJMSProvider -->
      DefaultJMSProvider
      StdJMSPool
      2
      1
      True
      </container-invoker-conf>
      <container-cache-conf/>
      <container-pool-conf>
      2
      1
      true
      </container-pool-conf>
      <commit-option>B</commit-option>
      <role-mapping-manager/>
      <authentication-module/>
      </container-configuration>
      </container-configurations>


      Pls check it and give correct suggestion