Polling Consumer

Pattern Catalog

Previous Previous   Next Next

Site HomePatterns HomeTable of Contents

An application needs to consume Messages, but it wants to control when it consumes each message.

How can an application consume a message when the application is ready?

The aplication should use a Polling Consumer, one that explicitly makes a call when it wants to receive a message.

This is also known as a synchronous receiver, because the receiver thread blocks until a message is received. We call it a Polling Consumer because the receiver polls for a message, processes it, then polls for another. As a convenience, messaging API’s usually provide a receive method that blocks until a message is delivered, in addition to methods like receiveNoWait() and Receive(0) that return immediately if no message is available. This difference is only apparent when the receiver is polling faster than messages are arriving.


Related patterns: Competing Consumers, Durable Subscriber, Event-Driven Consumer, Message, Message Dispatcher, Selective Consumer, Transactional Client

Enterprise Integration Patterns Find the full description of this pattern in:
Enterprise Integration Patterns
Gregor Hohpe and Bobby Woolf
ISBN 0321200683
650 pages
Creative Commons License Parts of this page are available under the Creative Commons Attribution license. You can reuse the pattern icon, the pattern name, the problem and solution statements (in bold), and the sketch under this license. Other portions of the text, such as text chapters or the full pattern text, are protected by copyright.

HomePatternsTable of ContentsPrevious Previous   Next Next