Selective Consumer

Camel supports the Selective Consumer from the EIP patterns book.

The Selective Consumer from the EIP patterns can be implemented in two ways


Selective Consumer using Components

The first solution is to provide a Message Selector to the underlying URIs when creating your consumer. For example when using JMS you can specify a selector parameter so that the message broker will only deliver messages matching your criteria.


Selective Consumer using Filter pattern

The other approach is to use a Message Filter which is applied; then if the filter matches the message your consumer is invoked as shown in the following example.


And in XML

    <from uri="seda:a"/>
        <simple>${} == 'bar'</xpath>
        <process ref="myProcessor"/>