One of the goals of the newly released EJB 2.0 spec was to
"Define the integration of EJB with the Java Message Service."
However, the EJB 2.0 spec **doesnot** specify how EJB's will use
JMS TemporaryDestinations as described in the JMS spec section
4.4.3
"One typical use for a TemporaryDestination is as the
JMSReplyTo destination for service requests."
EJB's cannot use TemporaryDestination as decribed in the above case.
For example consider the following scenario. A client
application(like a servlet) invokes create() on a
stateful bean. In ejbCreate the bean instance connects to a JMS
provider and a creates a TemporaryDestiantion and also
creates a MessageConsumer for the newly created
TemporaryDestination.
The client then invokes a business method( called B1) on
the bean. This business method sends a JMS message to an administered
Destination, with JMSReplyTo set to the TemporaryDestination(as described in
the JMS spec section 4.4.3.)
A JMSListner(a regular Java object and not a bean) picks the
the message and replies back to the TemporaryDestiantion.
After some time, the client application invokes
another business method(called B2) on the stateful bean.
Business method B2 checks to see if any message has been
delivered on the temporary queue by calling MessageConsumer.receiveNoWait()
The above scenario **doesnot** work if the stateful bean is
passivated between the two business method calls(B1 and B2).
For-example after B1, the container calls ejbPassivte.
Because the container serializes the bean instance, all con
nections(and thus the handle to the temporary destination)
to the JMS providor are lost. Now client calls B2.
Before invoking mothod B2, the container calls ejbActivate,
the beans gets a connection to the JMS provider, but cannot
get a handle back to the temporaryDestination as there is
not ceratinity that it gets back the original JMS connection
(TeomporaryDesitnation's lifetime is that of their connection and any of the
connection�s sessions are allowed to create a MessageConsumer for them).
So how does one use temporary destinations in EJBs ?? Am I missing
something. I would like to hear from the creators of the EJB and JMS specs.
Thanks
Nitin Sood
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".