我们正在尝试使用Spring AMQP在RabbitMQ中进行异步调用,谁能告诉我如何使用spring amqp配置replyqueue,correlationId,(属性)?
String corrId = java.util.UUID.randomUUID().toString();
BasicProperties props = new BasicProperties
.Builder()
.correlationId(corrId)
.replyTo(replyQueueName)
.build();
channel.basicPublish("", requestQueueName, props, message.getBytes());发布于 2013-11-08 18:04:53
我假设您需要使用RabbitTemplate
rabbitTemplate.convertAndSend(requestQueueName, myObj, new MessagePostProcessor() {
Message postProcessMessage(Message message) throws AmqpException {
message.getMessageProperties().setReplyTo(replyQueueName);
return message;
}
}, new CorrelationData(corrId));HTH
https://stackoverflow.com/questions/19855843
复制相似问题