You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sujin sr <su...@gmail.com> on 2019/08/07 07:05:39 UTC

InOut exchange pattern on Transactional JMS endpoint not working

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.

Re: InOut exchange pattern on Transactional JMS endpoint not working

Posted by sujin sr <su...@gmail.com>.
Hi  Claus  Ibsen ,

Could you please provide some input on the previous queries?

Thanks.

On Wed, 7 Aug 2019 at 13:07, sujin sr <su...@gmail.com> 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 <cl...@gmail.com> 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 <su...@gmail.com> 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
>>
>

AW: InOut exchange pattern on Transactional JMS endpoint not working

Posted by Burkard Stephan <St...@visana.ch>.
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 <su...@gmail.com> 
Gesendet: Mittwoch, 7. August 2019 09:37
An: users@camel.apache.org
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 <cl...@gmail.com> 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 <su...@gmail.com> 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
>

Re: InOut exchange pattern on Transactional JMS endpoint not working

Posted by sujin sr <su...@gmail.com>.
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 <cl...@gmail.com> 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 <su...@gmail.com> 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
>

Re: InOut exchange pattern on Transactional JMS endpoint not working

Posted by Claus Ibsen <cl...@gmail.com>.
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 <su...@gmail.com> 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