Apache Camel — Message Filter

How can a component avoid receiving uninteresting messages?

The Message Filter from the EIP patterns allows you to filter messages

//Java Bean to add the business logic
public static class MyBean {
public boolean isGoldCustomer(@Header(“level”) String level) {
return level.equals(“gold”);
}
}
//Configuration to filter 
<bean id=”myBean” class=”com.foo.MyBean”/>
<camelContext xmlns=”http://camel.apache.org/schema/spring">
<route>
<from uri=”direct:a”/>
<filter>
<method ref=”myBean” method=”isGoldCustomer”/>
<to uri=”direct:b”/>
</filter>
</route>
</camelContext>

References:

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.