--

On Mon, 25 Oct 1999 10:24:02   Mani wrote:
>Hello,
> I've couple of questions regarding EJB and JMS Integration. I read an article about 
>EJB and JMS, which says
>"EJBs are not allowed to create threads, so it can't create a thread to call 
>QueueReceiver.receive() to receive the messages from JMS".

That is in error, it is not necessary to create a thread in order to send or receive a 
message. You can activate a QueueReceiver on a QueueSession, receive either the next 
message on the queue or query the queue for specific message types and and then close 
the QueueReceiver and QueueSession.

Right now, you can use JMS as resource just as you use JDBC.  It has resources such as 
QueueConnections, Queues, and QueueSessions that you must manage intelligently because 
they consume resources and take time to set up.  However, because JMS has not been 
integrated into the specification, there are certain things that cannot be done using 
JMS and EJB.  The major one is the ability for JMS to call an EJB based on some 
message notification.  This would require the intervention of a third party 
application, Ian (see a previous thread) called it a message monitor.

>1. If  my EnterpriseBean doesn't want to receive any messages from JMS and interested 
>in only putting the messages to the JMS, can I use JMS ?

Yes, the message can be placed on a designated Queue using QueueSender or you can 
create a temporary queue.  However, usually the temporary queue is only good for the 
life of the connection.

>
>The same article also mentioned "EJB app servers are not integrated (I know some of 
>the EJB app servers are integrated with JMS. But I'd like to know the issues  if an 
>app server is not integrated), JMS can't invoke the onMessage callback of EJBs within 
>the EJBContainer
>2. If my EnterpriseBean is not interested in notifications from JMS what other 
>problems I'll have?
>
>Suppose if I'm using an EJB app server that is integrated with JMS, if I add a 
>message from an EnterpriseBean to JMS within a Transactional context, how the 
>transactional integrity is preserved  as the message is added from the 
>EnterpriseBean's transactional context to the JMS?
>
JMS is only a specification and is only as good as the underlying messaging system.  
Having said that, look at sections 4.4.7 and 4.4.13 that covers JMS and transactions.

4.4.7 states that "When a transaction commits, its atomic unit of input (message 
receive) is acknowledged and its associated atomic unit of output is sent (message 
send).  If a transaction rollback is done, its produced messages are destroyed and its 
consumed messages are automatically recovered"

>I'm trying to understand the issues behind creating threads, using JMS from an 
>EnterpriseBean.  Any pointers on the net will help me a lot.
>
>Thanks for your Time
>
>-Mani
>

Perry Hoekstra
Consultant
Talent Software Services



Get your FREE Email at http://mailcity.lycos.com
Get your PERSONALIZED START PAGE at http://my.lycos.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".

Reply via email to