Last active
December 18, 2015 11:38
-
-
Save pulkitsinghal/5776671 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<rabbit:template id="amqpTemplate" | |
connection-factory="connectionFactory" reply-queue="replies"> | |
<rabbit:reply-listener /> | |
</rabbit:template> | |
Can also be programatically configured like so: | |
@Bean(name="amqpTemplate") | |
public RabbitTemplate amqpTemplate() { | |
RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory()); | |
rabbitTemplate.setMessageConverter(...); | |
rabbitTemplate.setReplyQueue(responseQueue()); | |
rabbitTemplate.setReplyTimeout(...); | |
return rabbitTemplate; | |
} | |
@Bean | |
public SimpleMessageListenerContainer listenerContainer() { | |
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); | |
container.setConcurrentConsumers(5); | |
container.setConnectionFactory(connectionFactory()); | |
container.setQueues(responseQueue()); | |
container.setMessageListener(amqpTemplate()); | |
return container; | |
} | |
@Bean | |
public Queue responseQueue() { | |
return new Queue("routingKey_and_queueName_are_same_for_defaultExchange"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code is at producer end right? If, yes, where you have configured requestQueue for sending message? Can u please share me the link for the code which is having Producer and Consumer code. Thanks in advance.