[jboss-user] [JBoss Messaging Users] - Re: Possible transaction scopes for asynchronous reception?

chtimi2 do-not-reply at jboss.com
Fri Sep 4 10:47:37 EDT 2009

Sorry my question wasn't very clear.
I know that it isn't possible to produce and consume a message in the same transaction.

What i want to do is this:
If N messages have been produced in a single transaction T_prod, i want them to be consumed in a single transaction T_cons.
T_prod and T_cons don't have to be the same, i know that's not possible.

"ataylor" wrote : I'm not sure i understand your question. when you say 'consumption of the same set of messages' do you mean from a topic. 
  | If so the each consumer can consumer the messages within its own transaction. The transaction covers the delivery of the messages not the message itself.

Yes, i'm talking about a topic.
Let's say that the producer posts 2 messages, in a transaction (let's call it T_prod).

Let's say the consumer is a MDB: with Container Managed Transaction, each onMessage will execute in a new transaction, independant from T_prod.

What i'm wondering is whether it's possible, by using Bean Managed Transaction in the MDB, to get the 2 onMessage calls to execute within a single transaction. 

I'm thinking of a pattern like this:
-Producer side: put the T_prod transaction id in the message header
-Consumer side: read the transaction id to determine if the message is the first to be recieved from T_prod, manually start and commit

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4253602#4253602

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4253602

More information about the jboss-user mailing list