[jboss-user] [Messaging, JMS & JBossMQ] - MDB calls stateful bean

doktora do-not-reply at jboss.com
Mon Nov 20 17:30:34 EST 2006


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



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987432#3987432

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987432



More information about the jboss-user mailing list