On 22 Maj, Chree Haas wrote:
> Hey all,
> I'm having problems sending transacted messages from
> a MessageDrivenBean. In the attached example program, the client
> (test.Main) send a mesage to queue/A. MdbA receives the message
> and sends a second message queue/B which is received by MdbB.
> If the QueueSession in MdbA is created as transacted, the message
> is never sent to queue/B. If the QueueSession is created with
> a false, the message is received by MdbB.
>
> Did I miss something, or is there a bug in JBoss?
Hi, yes I think you missed something. A transacted session will only
send (commit) its data if you do that manually. I. e, you would have to
have code looking like this:
QueueSession session = queueConnection.createQueueSession(true,
Session.AUTO_ACKNOWLEDGE);
Queue queue = (Queue)context.lookup("queue/B");
QueueSender queueSender = session.createSender(queue);
TextMessage tm2 = session.createTextMessage("This is some text");
queueSender.send(tm2, DeliveryMode.PERSISTENT, Message.DEFAULT_PRIORITY,
Message.DEFAULT_TIME_TO_LIVE);
session.commit();//<--- Added row
session.close();
However, if you want JMS sends to truly be part of the container managed
transactions i EJB you will have to use the newly added JMS J2EE
Connector instead (for example if you want the sending of messages be
dependant on a database operation, and want them to either both commit
or both rollback).
This is only part of the development branch, and is not yet fully
documented. But take a look at the change note:
http://sourceforge.net/tracker/index.php?func=detail&aid=419301&group_id=22866&atid=381174
And the examples in the test jmsra in jbosstest.
//Peter
>
> Thanks,
> Chree
--
Jobba hos oss: http://www.tim.se/weblab
------------------------------------------------------------
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