You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jose <ja...@gmail.com> on 2014/03/12 11:18:40 UTC

JMS Consumer Transaction problem

Hi,

I have a route that invokes a bean that persists a message in the DB and,
afterwards, sends the message to a JMS queue. All of this happens within the
same transaction.

Apart from this, I have defined a JMS consumer to consume messages from the
JMS queue and retrieve the  previous message from the DB. 

The problem that I am getting that the consumer is run before the original
transaction is committed and, therefore, it cannot find the data in the DB.

Is there any wait to tell the sender "do not send the message to the queue
until the transaction is commited"? Or is there any way to trigger the
consumer once the original transaction has been committed?

Thanks.

Jose



--
View this message in context: http://camel.465427.n5.nabble.com/JMS-Consumer-Transaction-problem-tp5748683.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: JMS Consumer Transaction problem

Posted by Charlie Mordant <cm...@gmail.com>.
Hi,

What about putting the consumer or the method that produces the message out
of the transaction?

Otherwise, I think that you can retrieve the instance of the current
usertransaction/transactionmanager and see if the transaction is always
active.

Charlie,


2014-03-12 11:18 GMT+01:00 Jose <ja...@gmail.com>:

> Hi,
>
> I have a route that invokes a bean that persists a message in the DB and,
> afterwards, sends the message to a JMS queue. All of this happens within
> the
> same transaction.
>
> Apart from this, I have defined a JMS consumer to consume messages from the
> JMS queue and retrieve the  previous message from the DB.
>
> The problem that I am getting that the consumer is run before the original
> transaction is committed and, therefore, it cannot find the data in the DB.
>
> Is there any wait to tell the sender "do not send the message to the queue
> until the transaction is commited"? Or is there any way to trigger the
> consumer once the original transaction has been committed?
>
> Thanks.
>
> Jose
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/JMS-Consumer-Transaction-problem-tp5748683.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>