June 2018
Intermediate to advanced
408 pages
11h 23m
English
To receive the message asynchronously, the easiest way is to use an annotated listener endpoint. We will use the @RabbitListener annotation as a message listener endpoint. To create this listener endpoint, we have to configure a message listener container using the SimpleRabbitListenerContainerFactory class, which is an implementation of the RabbitListenerContainerFactory interface. The following code is used to configure SimpleRabbitListenerContainerFactory:
@Beanpublic SimpleRabbitListenerContainerFactory listenerContainer() { SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); factory.setConnectionFactory(connectionFactory()); factory.setMaxConcurrentConsumers(5); ...Read now
Unlock full access