Lokesh Raj Urs
Lokesh Raj Urs

Reputation: 361

Deliver message to consumer and expect response in RabbitMQ

I have a requirement where in (RabbitMQ)server sends the request to the client and client executes the operation and sends the response back to the server.

I would like to know which mechanism to use for this Topic, PubSub, Routing... Can we create the bi-directional connection like server-client similar to xmpp in rabbit mq, if yes how can we do?

thanks Lokesh

Upvotes: 1

Views: 817

Answers (1)

Gary Russell
Gary Russell

Reputation: 174554

You can use a Spring AMQP asynchronous consumer with a MessageListenerAdapter to invoke a POJO. See the reference documentation.

If you want more control; use a simple MessageListener and send the reply with a RabbitTemplate.

This test case shows an end-to-end configuration (client side and server side). The client side automatically takes care of setting the correlationId.

Upvotes: 2

Related Questions