InOut exchange pattern on Transactional JMS endpoint not working

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

InOut exchange pattern on Transactional JMS endpoint not working

sujinsr
Hi,

I have a use case where two jms queues are available those are
DataRequestQueue and DataReplyQueue. Where If I sent a message to the
DataRequestQueue MDB will process the message and send the response to
DataReplyQueue.

I have used Camel to send the message and receive the response. I have used
InOut Exchange pattern in camel to send and receive the response back.

Jms endpoint I am using is Transactional JMS endpoint, transaction manager
configured in spring bean.

.to("jms:queue:DataRequestQueue?replyTo=DataReplyQueue&exchangePattern=InOut&requestTimeout=60s")


When I try to send the message to the request queue using InOut exchange
camel throw ExchangeTimedOutException, but if I remove transaction manager
from the spring bean it working fine I able to get the response in the
reply queue.
I have also tried to create a separate jms component bean without
transaction manager for InOut exchange alone but it was also not working.

Kindly suggest some idea to make the camel route work fine.

https://access.redhat.com/documentation/en-us/red_hat_jboss_fuse/6.3/html/transaction_guide/fmrtxnjmssynchronous


This article suggested to use a separate queue for request and response,
but I cannot split the route and make the route async.

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: InOut exchange pattern on Transactional JMS endpoint not working

Claus Ibsen-2
Hi

You cannot do request/reply via reply queues with InOut and with
transactions as its a chicken/egg situation.
The message that is sent to the request queue (for req/reply) is not
committed until the transaction is committed and therefore the
received cannot "see" the message.

On Wed, Aug 7, 2019 at 9:05 AM sujin sr <[hidden email]> wrote:

>
> Hi,
>
> I have a use case where two jms queues are available those are
> DataRequestQueue and DataReplyQueue. Where If I sent a message to the
> DataRequestQueue MDB will process the message and send the response to
> DataReplyQueue.
>
> I have used Camel to send the message and receive the response. I have used
> InOut Exchange pattern in camel to send and receive the response back.
>
> Jms endpoint I am using is Transactional JMS endpoint, transaction manager
> configured in spring bean.
>
> .to("jms:queue:DataRequestQueue?replyTo=DataReplyQueue&exchangePattern=InOut&requestTimeout=60s")
>
>
> When I try to send the message to the request queue using InOut exchange
> camel throw ExchangeTimedOutException, but if I remove transaction manager
> from the spring bean it working fine I able to get the response in the
> reply queue.
> I have also tried to create a separate jms component bean without
> transaction manager for InOut exchange alone but it was also not working.
>
> Kindly suggest some idea to make the camel route work fine.
>
> https://access.redhat.com/documentation/en-us/red_hat_jboss_fuse/6.3/html/transaction_guide/fmrtxnjmssynchronous
>
>
> This article suggested to use a separate queue for request and response,
> but I cannot split the route and make the route async.
>
> Thanks.



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

Re: InOut exchange pattern on Transactional JMS endpoint not working

sujinsr
Thanks Claus Ibsen for the response.

So If I process replyQueue via a separate route I am wondering about the
below two points
  1. How I can transfer requestMessage headers values to the replyMessage
headers.
  2. I want to get the replyMessages only send from my producer alone, how
to listen on specific correlation ids using camel approach.
      This use case will occur when the same request/reply queue can have
other jms producers and consumers.

Kindly suggest some ideas.


On Wed, 7 Aug 2019 at 12:55, Claus Ibsen <[hidden email]> wrote:

> Hi
>
> You cannot do request/reply via reply queues with InOut and with
> transactions as its a chicken/egg situation.
> The message that is sent to the request queue (for req/reply) is not
> committed until the transaction is committed and therefore the
> received cannot "see" the message.
>
> On Wed, Aug 7, 2019 at 9:05 AM sujin sr <[hidden email]> wrote:
> >
> > Hi,
> >
> > I have a use case where two jms queues are available those are
> > DataRequestQueue and DataReplyQueue. Where If I sent a message to the
> > DataRequestQueue MDB will process the message and send the response to
> > DataReplyQueue.
> >
> > I have used Camel to send the message and receive the response. I have
> used
> > InOut Exchange pattern in camel to send and receive the response back.
> >
> > Jms endpoint I am using is Transactional JMS endpoint, transaction
> manager
> > configured in spring bean.
> >
> >
> .to("jms:queue:DataRequestQueue?replyTo=DataReplyQueue&exchangePattern=InOut&requestTimeout=60s")
> >
> >
> > When I try to send the message to the request queue using InOut exchange
> > camel throw ExchangeTimedOutException, but if I remove transaction
> manager
> > from the spring bean it working fine I able to get the response in the
> > reply queue.
> > I have also tried to create a separate jms component bean without
> > transaction manager for InOut exchange alone but it was also not working.
> >
> > Kindly suggest some idea to make the camel route work fine.
> >
> >
> https://access.redhat.com/documentation/en-us/red_hat_jboss_fuse/6.3/html/transaction_guide/fmrtxnjmssynchronous
> >
> >
> > This article suggested to use a separate queue for request and response,
> > but I cannot split the route and make the route async.
> >
> > Thanks.
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
Reply | Threaded
Open this post in threaded view
|

Re: InOut exchange pattern on Transactional JMS endpoint not working

sujinsr
Hi  Claus  Ibsen ,

Could you please provide some input on the previous queries?

Thanks.

On Wed, 7 Aug 2019 at 13:07, sujin sr <[hidden email]> wrote:

> Thanks Claus Ibsen for the response.
>
> So If I process replyQueue via a separate route I am wondering about the
> below two points
>   1. How I can transfer requestMessage headers values to the replyMessage
> headers.
>   2. I want to get the replyMessages only send from my producer alone, how
> to listen on specific correlation ids using camel approach.
>       This use case will occur when the same request/reply queue can have
> other jms producers and consumers.
>
> Kindly suggest some ideas.
>
>
> On Wed, 7 Aug 2019 at 12:55, Claus Ibsen <[hidden email]> wrote:
>
>> Hi
>>
>> You cannot do request/reply via reply queues with InOut and with
>> transactions as its a chicken/egg situation.
>> The message that is sent to the request queue (for req/reply) is not
>> committed until the transaction is committed and therefore the
>> received cannot "see" the message.
>>
>> On Wed, Aug 7, 2019 at 9:05 AM sujin sr <[hidden email]> wrote:
>> >
>> > Hi,
>> >
>> > I have a use case where two jms queues are available those are
>> > DataRequestQueue and DataReplyQueue. Where If I sent a message to the
>> > DataRequestQueue MDB will process the message and send the response to
>> > DataReplyQueue.
>> >
>> > I have used Camel to send the message and receive the response. I have
>> used
>> > InOut Exchange pattern in camel to send and receive the response back.
>> >
>> > Jms endpoint I am using is Transactional JMS endpoint, transaction
>> manager
>> > configured in spring bean.
>> >
>> >
>> .to("jms:queue:DataRequestQueue?replyTo=DataReplyQueue&exchangePattern=InOut&requestTimeout=60s")
>> >
>> >
>> > When I try to send the message to the request queue using InOut exchange
>> > camel throw ExchangeTimedOutException, but if I remove transaction
>> manager
>> > from the spring bean it working fine I able to get the response in the
>> > reply queue.
>> > I have also tried to create a separate jms component bean without
>> > transaction manager for InOut exchange alone but it was also not
>> working.
>> >
>> > Kindly suggest some idea to make the camel route work fine.
>> >
>> >
>> https://access.redhat.com/documentation/en-us/red_hat_jboss_fuse/6.3/html/transaction_guide/fmrtxnjmssynchronous
>> >
>> >
>> > This article suggested to use a separate queue for request and response,
>> > but I cannot split the route and make the route async.
>> >
>> > Thanks.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>>
>
Reply | Threaded
Open this post in threaded view
|

AW: InOut exchange pattern on Transactional JMS endpoint not working

Burkard Stephan
In reply to this post by sujinsr
Hi sujin sr

1. Don't worry, Camel is automatically copying the headers for you.

Just send the message on to the replyQueue

.from("activemq:queue:DataRequestQueue")
.to("activemq:queue:DataReplyQueue")

2. Not sure if I understand you correct: you mean how can each sender (if there are multiple) consume only its own message replies?

Use message selectors (https://activemq.apache.org/selectors.html). Each sender can for example set a header 'sender' with a unique ID. It can then use a message selector to listen to the DataReplyQueue, but consume only the messages with its own sender-ID.

Cheers
Stephan


-----Urspr√ľngliche Nachricht-----
Von: sujin sr <[hidden email]>
Gesendet: Mittwoch, 7. August 2019 09:37
An: [hidden email]
Betreff: Re: InOut exchange pattern on Transactional JMS endpoint not working

Thanks Claus Ibsen for the response.

So If I process replyQueue via a separate route I am wondering about the below two points
  1. How I can transfer requestMessage headers values to the replyMessage headers.
  2. I want to get the replyMessages only send from my producer alone, how to listen on specific correlation ids using camel approach.
      This use case will occur when the same request/reply queue can have other jms producers and consumers.

Kindly suggest some ideas.


On Wed, 7 Aug 2019 at 12:55, Claus Ibsen <[hidden email]> wrote:

> Hi
>
> You cannot do request/reply via reply queues with InOut and with
> transactions as its a chicken/egg situation.
> The message that is sent to the request queue (for req/reply) is not
> committed until the transaction is committed and therefore the
> received cannot "see" the message.
>
> On Wed, Aug 7, 2019 at 9:05 AM sujin sr <[hidden email]> wrote:
> >
> > Hi,
> >
> > I have a use case where two jms queues are available those are
> > DataRequestQueue and DataReplyQueue. Where If I sent a message to
> > the DataRequestQueue MDB will process the message and send the
> > response to DataReplyQueue.
> >
> > I have used Camel to send the message and receive the response. I
> > have
> used
> > InOut Exchange pattern in camel to send and receive the response back.
> >
> > Jms endpoint I am using is Transactional JMS endpoint, transaction
> manager
> > configured in spring bean.
> >
> >
> .to("jms:queue:DataRequestQueue?replyTo=DataReplyQueue&exchangePattern
> =InOut&requestTimeout=60s")
> >
> >
> > When I try to send the message to the request queue using InOut
> > exchange camel throw ExchangeTimedOutException, but if I remove
> > transaction
> manager
> > from the spring bean it working fine I able to get the response in
> > the reply queue.
> > I have also tried to create a separate jms component bean without
> > transaction manager for InOut exchange alone but it was also not working.
> >
> > Kindly suggest some idea to make the camel route work fine.
> >
> >
> https://access.redhat.com/documentation/en-us/red_hat_jboss_fuse/6.3/h
> tml/transaction_guide/fmrtxnjmssynchronous
> >
> >
> > This article suggested to use a separate queue for request and
> > response, but I cannot split the route and make the route async.
> >
> > Thanks.
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
Reply | Threaded
Open this post in threaded view
|

AW: InOut exchange pattern on Transactional JMS endpoint not working

Burkard Stephan
In reply to this post by sujinsr
Hi sujin sr

1. Don't worry, Camel is automatically copying the headers for you.

Just send the message on to the replyQueue

.from("activemq:queue:DataRequestQueue")
.to("activemq:queue:DataReplyQueue")

2. Not sure if I understand you correct: you mean how can each sender (if there are multiple) consume only its own message replies?

Use message selectors (https://activemq.apache.org/selectors.html). Each sender can for example set a header 'sender' with a unique ID. It can then use a message selector to listen to the DataReplyQueue, but consume only the messages with its own sender-ID.

Cheers
Stephan


-----Urspr√ľngliche Nachricht-----
Von: sujin sr <[hidden email]>
Gesendet: Mittwoch, 7. August 2019 09:37
An: [hidden email]
Betreff: Re: InOut exchange pattern on Transactional JMS endpoint not working

Thanks Claus Ibsen for the response.

So If I process replyQueue via a separate route I am wondering about the below two points
  1. How I can transfer requestMessage headers values to the replyMessage headers.
  2. I want to get the replyMessages only send from my producer alone, how to listen on specific correlation ids using camel approach.
      This use case will occur when the same request/reply queue can have other jms producers and consumers.

Kindly suggest some ideas.


On Wed, 7 Aug 2019 at 12:55, Claus Ibsen <[hidden email]> wrote:

> Hi
>
> You cannot do request/reply via reply queues with InOut and with
> transactions as its a chicken/egg situation.
> The message that is sent to the request queue (for req/reply) is not
> committed until the transaction is committed and therefore the
> received cannot "see" the message.
>
> On Wed, Aug 7, 2019 at 9:05 AM sujin sr <[hidden email]> wrote:
> >
> > Hi,
> >
> > I have a use case where two jms queues are available those are
> > DataRequestQueue and DataReplyQueue. Where If I sent a message to
> > the DataRequestQueue MDB will process the message and send the
> > response to DataReplyQueue.
> >
> > I have used Camel to send the message and receive the response. I
> > have
> used
> > InOut Exchange pattern in camel to send and receive the response back.
> >
> > Jms endpoint I am using is Transactional JMS endpoint, transaction
> manager
> > configured in spring bean.
> >
> >
> .to("jms:queue:DataRequestQueue?replyTo=DataReplyQueue&exchangePattern
> =InOut&requestTimeout=60s")
> >
> >
> > When I try to send the message to the request queue using InOut
> > exchange camel throw ExchangeTimedOutException, but if I remove
> > transaction
> manager
> > from the spring bean it working fine I able to get the response in
> > the reply queue.
> > I have also tried to create a separate jms component bean without
> > transaction manager for InOut exchange alone but it was also not working.
> >
> > Kindly suggest some idea to make the camel route work fine.
> >
> >
> https://access.redhat.com/documentation/en-us/red_hat_jboss_fuse/6.3/h
> tml/transaction_guide/fmrtxnjmssynchronous
> >
> >
> > This article suggested to use a separate queue for request and
> > response, but I cannot split the route and make the route async.
> >
> > Thanks.
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>