Vidya_85
Vidya_85

Reputation: 77

Will polling mechanism cause a concern in DefaultMessageListenerContainer

The documentation for DefaultMessageListener container reads:

"Message listener container variant that uses plain JMS client API, specifically a loop of MessageConsumer.receive() calls"

As Juergen states in the post http://forum.spring.io/forum/other-spring-related/remoting/24208-what-s-the-best-practice-for-using-jms-in-spring , I could understand that it is the recommendable approach.

But basically afraid of the pull mechanism that it does, as, there is a general opinion that event driven mechanism is better than pull model with respect to resource usage and blocking behaviour.

Will there be any kind of issues or concerns while using DefaultMessageListener .

Please advise

Upvotes: 0

Views: 401

Answers (1)

Gary Russell
Gary Russell

Reputation: 174759

It really does become event-driven; the container is not polling the server, it's polling the client library to see if any new messages have arrived. It really doesn't use any significant resources.

You can increase the receive timeout if your are concerned; the downside being that the container will be less responsive to a stop() request.

Upvotes: 1

Related Questions