Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pulkitsinghal/5776671 to your computer and use it in GitHub Desktop.
Save pulkitsinghal/5776671 to your computer and use it in GitHub Desktop.
<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");
}
@sekhar434145
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment