JMS Examples: Configuring Message Buffering
11.1.32. No Consumer Buffering By default, HornetQ consumers buffer messages from the server in a client side buffer before you actually receive them on the client side. This improves performance since otherwise every time you called receive() or had processed the last message in a MessageListener onMessage() method, the HornetQ client would have to go the server to request the next message, which would then get sent to the client side, if one was available. This would involve a network round trip for every message and reduce performance. Therefore, by default, HornetQ pre-fetches messages into a buffer on each consumer. In some case buffering is not desirable, and HornetQ allows it to be switched off. This example demonstrates that.