What's the difference between SimpleMessageListenerContainer
and DirectMessageListenerContainer
in Spring AMQP? I checked both of their documentation pages, SimpleMessageListenerContainer
has almost no explanation on inner workings, and DirectMessageListenerContainer
has the following explanation:
The SimpleMessageListenerContainer is not so simple. Recent changes to the rabbitmq java client has facilitated a much simpler listener container that invokes the listener directly on the rabbit client consumer thread. There is no txSize property - each message is acked (or nacked) individually.
I don't really understand what these mean. It says listener container that invokes the listener directly on the rabbit client consumer thread
. If so, then how does SimpleMessageListenerContainer
do the invocation?
I wrote a small application and used DirectMessageListenerContainer
and just to see the difference, I switched to SimpleMessageListenerContainer
, but as far as I can see there was no difference on RabbitMQ side. From Java side the difference was in methods (SimpleMessageListenerContainer
provides more) and logs (DirectMessageListenerContainer
logged more stuff)
I would like to know the scenarios to use each one of those.