0 Replies Latest reply on Nov 20, 2006 5:30 PM by doktora

    MDB calls stateful bean

    doktora

      Is it OK if an MDB that receives messages from a durable topic calls on a stateful bean (indirectly) to process them.

      The stateful bean is created and managed by an MBean at system start-up.

      The MDB calls methods in the MBean which access the stateful bean:

      Here is some pseudo-code:

      @Service
      public class MyMBean implments MyMBeanInterface, MBeanRegistration
      {
       @EJB private MyStatefulBeanInterface statefulBean;
      
       public void onMessage(Object msg) { statefulBean.process(msg); }
      
      }
      
      -----------
      
      @MessageDriven
      public class MyMessageReceiver implements MessageListener
      {
       public void onMessage(Message msg)
       {
       MyMBeanInterface mbean = MBeanProxyExt.create(....);
      
       mbean.onMessage( ((ObjectMessage)msg).getObject() );
       }
      }
      
      


      Is there any design problem with this?

      Are the calls coming from JMS serialized or is there no guarantee that asynchronous calls will be made to the Stateful bean?

      Would there be any issues to watch out for if this was to live in a cluster and a lot of messages come in (up to a hundred a second at times)? Would it be a replication nightmare?


      I've been pondering on these questions and have some reservations as to whether the above scenario can work reliably in a production environment.

      Any input would be greatly appreciated!

      Thanks,
      doktora