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() );
}
}