0

After make a search about different ways to implement it, im stuck. What im looking for is to realize this example (https://www.rabbitmq.com/tutorials/tutorial-six-spring-amqp.html) with Spring Integration. I had found interesting post as this (Spring integration with Rabbit AMQP for "Client Sends Message -> Server Receives & returns msg on return queue --> Client get correlated msg") but didn't help me with what i need. My case mill be a system where a client call the "convertSendAndReceive" method and a server (basede on Spring Integration) will response.

Thanks

  • what is the question? – ESala Jan 26 '18 at 09:13
  • Mostly know if is possible to implement it using Spring Integration and RabbitMQ with RPC. For now i have an Inbound Channel Adapter working, but im not sure what implement for work properly with the call method "convertSendAndReceive" – Guillermo Garcia Jan 26 '18 at 10:02

1 Answers1

0

According to your explanation it sounds like Outbound Gateway on the Client side and Inbound Gateway on the Server side pair is what you need.

Spring Integration AMQP support provides those implementations for you with built-in correlation functionality: https://docs.spring.io/spring-integration/docs/5.0.0.RELEASE/reference/html/amqp.html

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • Excuse the delay, thanks for the answer. I have already implemented the inbound gateway in server, but when i try to implement the ouputChannel to send de response from the server i dont know if i have to send it to the same queue or to another different. The thing is Excuse the delay, thanks for the answer. I have implemented the inbound gateway in server, but when i try to implement the ouputChannel to send de response from the server i dont know if i have to send it to the same queue or to another different. The thing is RPC implement automatically the response queue, any option? – Guillermo Garcia Jan 29 '18 at 07:59
  • That is exactly what is done by the `temporary queue` for reply by default. Or you can configure `setReplyAddress()` on the `RabbitTemplate`. The Inbound gateway definitely should rely on the `ReplyTo` header supplied by the request message. There on the server you should just rely on the `replyChannel` header and the Inbound Gateway will do the correlation and reply producing logic for you. – Artem Bilan Jan 29 '18 at 15:15
  • Great, i didnt observe the setReplyAddress() property. – Guillermo Garcia Jan 30 '18 at 12:06
  • Great, i didnt observe the setReplyAddress() property. So for the replyChannel i guest i will have to implemt an AmqpOutboundEndpoint that redirect back the responses like: '@ServiceActivator(inputChannel = "configurationChannel") public AmqpOutboundEndpoint amqpOutbound(AmqpTemplate amqpTemplate) ' In the setExchangeName() it will automatically fill with the reply address i understand, correct? – Guillermo Garcia Jan 30 '18 at 12:22