Reputation: 1175
We are trying to make asynchronous call in RabbitMQ using Spring AMQP, could any one please tell me how to configure replyqueue, correlationId, (properties) using spring amqp?
String corrId = java.util.UUID.randomUUID().toString();
BasicProperties props = new BasicProperties
.Builder()
.correlationId(corrId)
.replyTo(replyQueueName)
.build();
channel.basicPublish("", requestQueueName, props, message.getBytes());
Upvotes: 0
Views: 1944
Reputation: 121560
I assume you need to use RabbitTemplate
:
rabbitTemplate.convertAndSend(requestQueueName, myObj, new MessagePostProcessor() {
Message postProcessMessage(Message message) throws AmqpException {
message.getMessageProperties().setReplyTo(replyQueueName);
return message;
}
}, new CorrelationData(corrId));
HTH
Upvotes: 1