Skip to Content
Technical Articles
Author's profile photo Bhalchandra Wadekar

EIPinCPI – Selective Consumer

Previous – Message Dispatcher | Index | Next – Durable Subscriber

This week, we’ll study a pattern known as Selective Consumer.

When do I use this pattern?

Selective Consumer, as the name suggests, is used when the selection criteria for consuming a message is coded inside a consumer. The consumer decides whether the message is consumed or not. Note that Selective Consumer is different from Message Filter. In Message Filter, the consumer consumes the message and then decides to discard the message based on a condition. Whereas, Selective Consumer does not consume the message in the first place.

Selective Consumer in CPI

In CPI, I’ll demonstrate Selective Consumer using OData Receiver Adapter. We’ll use the same example from the Message Filter blog. The flow is interested only in products supplied by ‘Exotic Liquids’.

Integration Flow


Exotic Liquids

The Integration flow starts immediately using Timer Start Event, reads the products only supplied by Exotic Liquids using OData Receiver Adapter, and logs the body using Groovy Script.

This is how OData Receiver Adapter is configured to make this flow a Selective Consumer:

Tab Property Value
Connection Address
Connection CSRF Protected Unchecked
Processing Operation Details Query (GET)
Processing Resource Path Products
Processing Query Options $filter=SupplierID eq 1

Here, we are using OData Filter to implement a Selective Consumer.


When the integration flow is deployed, all products supplied by ‘Exotic Liquids’ are fetched and logged.


Products supplied by Exotic Liquids

EIPinCPI Rating – 8/10

Selective Consumer in CPI is implemented easily using the configuration of Adapter. However, the implementation highly depends on the Adapter’s functionality. Therefore, I am going to rate Selective Consumer in CPI to be 8/10.

How can SAP improve EIPinCPI Rating?

JMS is one of the important features of CPI to support asynchronous messaging and retry mechanism. EIPinCPI rating would improve if JMS Sender Adapter supported Selective Consumer pattern. JMS Sender Adapter could have an input for selecting the message based on Header value or Exchange Property value.


Selective Consumer is useful when the consumer wants to consume message based on a condition. The alternative to using Selective Consumers is Message Dispatcher.

References/Further Readings

Hope this helps,

 Previous – Message Dispatcher | Index | Next – Durable Subscriber

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Daniel Graversen
      Daniel Graversen


      Great you added the rating and recommendations. Makes it a lot easier to understand CPIs capabilities in your view.