How to add a local interface into a JMS message

Discussions

EJB design: How to add a local interface into a JMS message

  1. Hey folks,

    Here is my problem. I need to send a local interface to a message driven bean through a JMS message. In this message, I want to include a local interface for a session bean. How can I achieve this? I don't want to send a remote interface because I really know they will run in the same JVM.

    More specifically, the message driven bean is used to execute the session bean asynchronously.

    Thanks in advance!

    Ron
  2. Hi,

    If the session bean is a statless session bean, it would be easier to perform a lookup in your MDB and invoke your method on the stateless session bean.
    If the session bean would be a remote stateful session bean (which is not your case), I would suggest putting in the message the ejb object handle. If your session bean is a local stateful session bean you don't have handles, and maybe a registry mechanism could help you.
    In both cases of stateful session beans (local and remote) you have to be consider the concurrency issues: the specs forbids concurrent access on the same stateful session bean. If more than one message get to be processed simultaneously you might get an EJBException. However, some smart j2ee servers perform method call serialization on stateful session beans.

    Best regards, Mircea
  3. Thank you, buddy.