You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by gludington <gl...@gmail.com> on 2017/07/30 23:12:49 UTC

RPC Type calls in rabbitmq

Is there an analogue to the "gateways" in spring integration in camel?  We
have some RPC style flows, whereby a message is dropped off, processed by a
flow, and returned to a temporary destination for the response.  In spring
integration, there would be a single entity:

   <int-amqp:inbound-gateway auto-startup="true"
        request-channel="requestChannel"
        reply-channel="finalChannel"
        receive-timeout="10000"
        amqp-template="rpcTemplate"
        error-channel="errorChannel"
        queue-names="some.queue.name"/>

Where a message comes in requestChannel, a defined flow processes
everything, and, when the response hits finalChannel, it is sent back to the
destination the client is waiting.  I can see from 

https://issues.apache.org/jira/browse/CAMEL-8604

Variations on the technique discussed there have not worked for me, as some
flows have to go through multiple routes.  For example:

from("rabbitmq://localhost:13355/rpc?connectionFactory=#nativeConnectionFactory&queue=some.queue&autoAck=false")
   .setProperty (RabbitMQConstants.REPLY_TO) .header
(RabbitMQConstants.REPLY_TO)
   .to("log:Test?level=WARN&showBody=true&showHeaders=true")
   .to("direct:start");

..start would be a kickoff of one of the flows in question..
from("direct:end")
                                            .setProperty
(RabbitMQConstants.REPLY_TO) .header (RabbitMQConstants.REPLY_TO)
  
.to("rabbitmq://localhost:13355/rpc?connectionFactory=#nativeConnectionFactory&queue=some.queue&exchangeType=direct&autoDelete=false")

Regardless of the ExchangePatterns i set, i see this on the server logs:

Header with 
rabbitmq.EXCHANGE_NAME=rpc,
rabbitmq.REPLY_TO=amq.gen-8tZWmahpHYF5rIbHjFHKJg, rabbitmq.ROUTING_KEY=

coming in, but the server picks a different temporary queue name to respond:

Using temporary queue name: amq.gen-nujvM6rMwO13WuRK5pF1JA

which results in the message not getting back to the the client.  

I would very much appreciate it if somebody can point out my
misconfiguration/use here

Thank you,
Greg



--
View this message in context: http://camel.465427.n5.nabble.com/RPC-Type-calls-in-rabbitmq-tp5808797.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: RPC Type calls in rabbitmq

Posted by gludington <gl...@gmail.com>.
Following up, there is a mismatch in the exchanges.  The client fires off a
message that is received at the server with headers including:

breadcrumbId=ID-perry-57204-1501534382504-0-1
rabbitmq.CORRELATIONID=Camel-ID-perry-57204-1501534382504-0-3
rabbitmq.EXCHANGE_NAME=rpc
rabbitmq.REPLY_TO=amq.gen-D_UwBpDtdRzmZvW5N_Pe7g
rabbitmq.ROUTING_KEY=

and waits for a reply on the exchange ID-perry-57204-1501534382504-0-2
(incremented by the context generator).  The value is incremented once more
for the correlationId to be passed to the server.  However, this -02 value
indicating the exchange is never passed to the server, which then tries to
return it to a location the client is not waiting to receive, which results
in a timeout:

Caused by: org.apache.camel.ExchangeTimedOutException: The OUT message was
not received within: 20000 millis due reply message with correlationID:
Camel-ID-perry-57204-1501534382504-0-3 not received on destination:
amq.gen-D_UwBpDtdRzmZvW5N_Pe7g. Exchange[ID-perry-57204-1501534382504-0-2]

This exchange ID-perry-57204-1501534382504-0-2 is not published on any
headers or properties of the message; is there a proper way to communicate
this part of the reply location so that the server can respond to the proper
destination?

Thank you,
Greg



--
View this message in context: http://camel.465427.n5.nabble.com/RPC-Type-calls-in-rabbitmq-tp5808797p5808902.html
Sent from the Camel - Users mailing list archive at Nabble.com.