JMS Consumer Transaction problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

JMS Consumer Transaction problem

Jose
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
Reply | Threaded
Open this post in threaded view
|

Re: JMS Consumer Transaction problem

Tcharl
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 <[hidden email]>:

> 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.
>