Competing Consumers

Pattern Catalog

Previous Previous   Next Next

Site HomePatterns HomeTable of Contents

An application is using Messaging. However, it cannot process messages as fast as they’re being added to the channel.

How can a messaging client process multiple messages concurrently?

Create multiple Competing Consumers on a single channel so that the consumers can process multiple messages concurrently.

Competing Consumers are multiple consumers that are all created to receive messages from a single Point-to-Point Channel. When the channel delivers a message, any of the consumers could potentially receive it. The messaging system's implementation determines which consumer actually receives the message, but in effect the consumers compete with each other to be the receiver. Once a consumer receives a message, it can delegate to the rest of its application to help process the message. (This solution only works with Point-to-Point Channels; multiple consumers on a Publish-Subscribe Channel just create more copies of each message.)


Related patterns: Event-Driven Consumer, Message, Message Channel, Message Dispatcher, Messaging, Point-to-Point Channel, Polling Consumer, Publish-Subscribe Channel, 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