GRaj
GRaj

Reputation: 83

Spring AMQP advantages / disadvantages of using SimpleMessageListenerContainer over Receiving message from a queue

I would like to know the advantages and disadvantages of using SimpleMessageListenerContainer over receiving a message manually using Spring AMQP. Another question is when we create SimpleMessageListenerContainer setting a queue, does the rabbitmq calls the listeneradaptor or does SimpleMessageListenerContainer keeps polling the queue to check for messages and calls the registered adaptor when their is message.

Upvotes: 0

Views: 905

Answers (1)

Gary Russell
Gary Russell

Reputation: 174574

It depends on your requirements; the listener container gives you an async (message-driven) approach. Otherwise, if you use the RabbitTemplatereceive methods, you are polling the queue. The container does not poll the queue, the broker pushes messages to the container according to the prefetch settings (default 1) - if using ackmode AUTO.

Upvotes: 0

Related Questions