Idempotent ConsumerThe Idempotent Consumer This pattern is implemented using the IdempotentConsumer The Idempotent Consumer essentially acts like a Message Filter to filter out duplicates. Using the Fluent Builders The following example will use the header myMessageId to filter out duplicates RouteBuilder builder = new RouteBuilder() { public void configure() { from("queue:a").idempotentConsumer( header("myMessageId"), memoryMessageIdRepository(200) ).to("queue:b"); } }; The above example return new SpringRouteBuilder() { public void configure() { from("direct:start").idempotentConsumer( header("messageId"), jpaMessageIdRepository(bean(JpaTemplate.class), "myProcessorName") ).to("mock:result"); } }; In the above example Using the Spring XML Extensions <camelContext id="buildCustomProcessorWithFilter" xmlns="http://activemq.apache.org/camel/schema/spring"> <route> <from uri="queue:a"/> <filter> <predicate> <header name="foo"/> <isEqualTo value="bar"/> </predicate> </filter> <process ref="#myProcessor"/> </route> </camelContext> For further examples of this pattern in use you could look at the junit test case Using This PatternIf you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. |