Skip to Content
Technical Articles

EIPinCPI – Competing Consumers

Previous – Event-Driven Consumer | Index | Next – Message Dispatcher

This week, we’ll study a pattern known as Competing Consumers.

When do I use this pattern?

This pattern is used when the message creation is faster than the message consumption and performance is important. In this pattern, Consumers compete with each other to consume the message, therefore the pattern is named Competing Consumers.

Competing Consumers in CPI

In CPI, the Competing Consumers pattern is easily implemented by setting the Number of Concurrent Processes configuration in JMS Sender Adapter

Integration Flow

Process%20Messages

Process Messages

In the example, the integration flow only consumes the message and logs it.

These configurations have been changed for JMS Sender Adapter as follows:

Property Value
Queue Name Messages
Number of Concurrent Processes 5

Conclusion

Competing Consumers pattern is applied when consuming the message one by one becomes a bottleneck. When message consumption is slower than message creation, applying the Competing Consumers pattern can speed up the consumption.

References/Further Readings

Previous – Event-Driven Consumer | Index | Next – Message Dispatcher

/
Process%20Messages
Be the first to leave a comment
You must be Logged on to comment or reply to a post.