vendredi 20 mars 2015

How to add an additional Listener to listen to queue with Spring AMQP?

I currently have my RabbitMQ configured which has a Listener that listens to a queue like this:



@Configuration
public class RabbitMQConfig {
@Bean
public MessageListenerContainer messageListenerContainer() {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.setQueues(workQueue());
container.setMessageListener(new MessageListenerAdapter(listener1, new JsonMessageConverter()));
container.setDefaultRequeueRejected(false);
return container;
}
}


How do I add another Listener class to listen to the same queue? (The listener will have a handleMessage(T msg) whose message typed is different than my other Listener.


Aucun commentaire:

Enregistrer un commentaire