Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added documentation for hazelcast idempotent repository

...

  • MemoryIdempotentRepository
  • FileIdempotentRepository
  • HazelcastIdempotentRepository (Available as of Camel 2.8)
  • JdbcMessageIdRepository (Available as of Camel 2.7)
  • JpaMessageIdRepository

...

Wiki Markup
{snippet:id=e1|lang=xml|title=Filter duplicate messages|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringIdempotentConsumerNoSkipDuplicateFilterTest.xml}

How to handle duplicate message in a clustered environment with a data grid

Available as of Camel 2.8

If you have running Camel in a clustered environment, a in memory idempotent repository doesn't work (see above). You can setup either a central database or use the idempotent consumer implementation based on the Hazelcast data grid. Hazelcast finds the nodes over multicast (which is default - configure Hazelcast for tcp-ip) and creates automatically a map based repository:

Code Block
java
java

  HazelcastIdempotentRepository idempotentRepo = new HazelcastIdempotentRepository("myrepo");

  from("direct:in").idempotentConsumer(header("messageId"), idempotentRepo).to("mock:out");

You have to define how long the repository should hold each message id (default is to delete it never). To avoid that you run out of memory you should create an eviction strategy based on the Hazelcast configuration. For additional information see camel-hazelcast.

Include Page
CAMEL:Using This Pattern
CAMEL:Using This Pattern