EIPinCPI – Competing Consumers

December 15, 2019 Bhalchandra Wadekar

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

About the Author

Bhalchandra Wadekar

Bhalchandra Wadekar is an Integration Enthusiast who authored the Enterprise Integration Patterns in SAP Cloud Platform Integration (#EIPinCPI) series on SAP Blog Community. He is a fan of integration from API Management and Open Connectors to Message Based Integration and Data Integration.

More Content by Bhalchandra Wadekar
Previous Article
EIPinCPI – Durable Subscriber
EIPinCPI – Durable Subscriber

Next Article
EIPinCPI – Messaging Mapper
EIPinCPI – Messaging Mapper