Page Edited :
CAMEL :
Idempotent Consumer
Idempotent Consumer has been edited by Claus Ibsen (Jun 07, 2009). Content:Idempotent ConsumerThe Idempotent Consumer This pattern is implemented using the IdempotentConsumer The Idempotent Consumer essentially acts like a Message Filter to filter out duplicates. Camel will add the message id eagerly to the repository to detect duplication also for Exchanges currently in progress. Using the Fluent Builders The following example will use the header myMessageId to filter out duplicates RouteBuilder builder = new RouteBuilder() { public void configure() { errorHandler(deadLetterChannel("mock:error")); from("seda:a").idempotentConsumer(header("myMessageId"), MemoryIdempotentRepository.memoryIdempotentRepository(200)) .to("seda:b"); } }; The above example from("direct:start").idempotentConsumer( header("messageId"), jpaMessageIdRepository(lookup(JpaTemplate.class), PROCESSOR_NAME) ).to("mock:result"); In the above example 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. |
Unsubscribe or edit your notifications preferences