On 27 Maj, Lars Olsson wrote:
> I have an application with two queues and two message driven beans:
> 
>   Client --->   q1  ---> mdbA  ---> q2  ---> mdbB
> 
> In the onMessage() method of mdbA the incoming message is inspected
> and then passed on to mdbB via q2.
> 
> Bean mdbA uses container managed transactions and its onMessage() method
> has its transaction attribute set to Required.
> 
> Bean mdbA sets up queue connection, queue session and queue sender for q2
> in its ejbCreate() method.
> 
> According to the Sun JMS tutorial, which has a section on JMS use in EJBs,
> the arguments to QueueConnection.createQueueSession() are ignored when
> queues are used inside beans that use container managed transactions. 
> I have experienced behaviour that seems to contradict this: If the bean
> mdbA creates its queue session (for q2) like this:
> 
>   qsession = qconn.createQueueSession(true,0);
> 
> then the messages it sends to q2 never reaches mdbB unless mdbA explicitly
> calls qsession.commit() even though it uses container managed transactions.
> 
> If QueueConnection.createQueueSession() is called with the transact-argument
> set to false, mdbA is able to send its message to mdbB without having to call
> QueueSession.commit().
> 
> I had hoped that the container of mdbA would automatically call QueueSession.commit()
> regardless of how the session was constructed,  since mdbA uses container managed 
> transactions and its onMessage() method has the transactional attribute set to 
>Required.
> 
> Are my expectations reasonable?

Well, they are. But they are not implemented in the JBoss 2.2 series.
What you actually want is to have container managed transactions also
for JMS sending (which has nothing particular to do with Message Driven
Beans since you may do that in Session- and Entity beans to). 

But for that to work the JMS implementation must somehow be tightly
integreated into the J2EE server, which is not the case for JBoss and
JBossMQ. 

The only part of the JMS/J2EE affiliation that is implemented in JBoss
2.2.x is Message Driven Bean with transaction support. 

However when you get a ConnectionFactory through JNDI from JBossMQ the
connection/session will not be enrolles in any transactions at al, but
must be manually managed.

In the developmen version of JBoss there is a new JMS J2EE connector
resource adapter, which supports containermanaged persistence for
sending JMS messages from enterprise beans.

It is brifly described in the Change Note:
http://sourceforge.net/tracker/index.php?func=detail&aid=419301&group_id=22866&atid=381174

And there are some test exeamples in the jmsra part of jbosstest.

There is nothing in it that woul not make it possible to use in
JBoss2.2.1, it just has to be done manualy by configuring jboss.jcml and
extracting the classes under org/jboss/jms and make them available.

//Peter

> 
> I am using JBOSS 2.2.1.
> 
> Lars
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user

-- 
------------------------------------------------------------
Peter Antman             Technology in Media, Box 34105 100 26 Stockholm
Systems Architect        WWW: http://www.tim.se
Email: [EMAIL PROTECTED]        WWW: http://www.backsource.org
Phone: +46-(0)8-506 381 11 Mobile: 070-675 3942 
------------------------------------------------------------


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to