I'm following the instructions for the Stock Trading
sample, which outlines how to use request/reply messaging in spring-amqp
: http://static.springsource.org/spring-amqp/docs/1.2.x/reference/html/sample-apps.html#d4e742
I've tweaked the sample instructions to create a client which should wait for the reply by using convertSendAndReceive
instead of convertAndSend
: https://gist.github.com/pulkitsinghal/5774487
Now even though the reply is put on the responseQueue and I've updated the timeout rabbitTemplate.setReplyTimeout(60000);
to be longer than the 5 second default ... in my client I receive null
back as the reply.
Does anyone know what's going on?
Update#1
I was advised to add a <reply-listener/>
to the <rabbit:template/>
but I'm not sure how to do that programatically:
@Bean
public RabbitTemplate rabbitTemplate() {
RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory());
rabbitTemplate.setMessageConverter(jsonMessageConverter());
rabbitTemplate.setReplyQueue(responseQueue());
rabbitTemplate.setReplyTimeout(60000);
// following is private
//rabbitTemplate.addListener
return rabbitTemplate;
}