Discussions
EJB programming & troubleshooting: Can i write a stateful sessionbean implement a messagelistener
-
Can i write a stateful sessionbean implement a messagelistener (3 messages)
- Posted by: Punam Chordia
- Posted on: November 14 2002 00:07 EST
my design requires me to write a stateful session bean which will implement jms message listener. Teh stateful bean will bind to a queue and listen for messages. Is it correct to design so and is it implmentable?Threaded Messages (3)
- Can i write a stateful sessionbean implement a messagelistener by Fred Deb on November 14 2002 05:04 EST
- Can i write a stateful sessionbean implement a messagelistener by Tomas Inger on November 14 2002 08:50 EST
- Can i write a stateful sessionbean implement a messagelistener by Web Master on November 14 2002 09:37 EST
-
Can i write a stateful sessionbean implement a messagelistener[ Go to top ]
- Posted by: Fred Deb
- Posted on: November 14 2002 05:04 EST
- in response to Punam Chordia
Hi,
You can implement stateful session bean to be synchronous message listener - my understanding.
regs
Fred -
Can i write a stateful sessionbean implement a messagelistener[ Go to top ]
- Posted by: Tomas Inger
- Posted on: November 14 2002 08:50 EST
- in response to Punam Chordia
Hi!
From a quick look in the specification, I cannot find something saying "you should not" on this point.
However, to me it seems a bit strange and I havn't seen anything like this before. You should be aware for the concept of durable/non-durable when registring the message listener.
Also note that you may end up in a situation when two threads execure your EJB at the same time: Your normal client thread and the thread started by an incoming message.
/Tomas -
Can i write a stateful sessionbean implement a messagelistener[ Go to top ]
- Posted by: Web Master
- Posted on: November 14 2002 09:37 EST
- in response to Tomas Inger
Although java does not prevent you to have a session bean implementing messageLiListener, the J2EE does not allow multi threading in EJB. and the idea of EJB blocking waiting a message to arrive is not feasible. Look at it this way: EJBs are not guaranteed to exist between method calls depending on the container. If the been is not called for a while it might be passivated.
Read this Article:
http://www7b.boulder.ibm.com/wsdd/library/techarticles/0105_burgett/0105_burgett.html