What really happens under the hood when i set a messageListener on my queue MessageConsumer object. Does the MessageConsumer object make some sort of polling ehind the scene or this is a real push made by the JMS server?
Java Message Service (O'Reilly Java Series) by David A. Chappell, Richard Monson-Haefel and Mark Richards, p10 CHAPTER1: Point-to-point
The point-to-point messaging model has traditionally been a pullbased or polling-based model, where messages are requested from the queue instead of being pushed to the client automatically
http://docs.oracle.com/javaee/1.4/tutorial/doc/JMS4.html#wp79175
When message delivery begins, the JMS provider automatically calls the message listener's onMessage method whenever a message is delivered.
Thanks, Kod
These two do not contradict each other. P2P is essentially pull-based, in that it is receiver's responsibility to read a message once it is sent by a producer. onMessage() method that you mentioned in your 2nd quote is a notification mechanism used to initiate the pull. These variations also referred to as sync vs async modes of receiving JMS messages, as for example in this chapter in Java Tutorial.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With