Asiri Liyana Arachchi
Asiri Liyana Arachchi

Reputation: 2673

What is Camel KafkaIdempotentRepository and the uses of it?

I'm trying to get the msg with the latest offset in kafka. Can this be used to get that? 'KafkaIdempotentRepository' If not what's the use of it?

In the java doc it says the following. But it's not clear what's the real use of it.

enter image description here

Upvotes: 0

Views: 1070

Answers (1)

Sudhesh Rajan
Sudhesh Rajan

Reputation: 367

Camel Idempotent Repository implementations are used as consumer to filter out duplicate messages. And KafkaIdempotentRepository is one of the many implementations Camel provide (e.g. others are MemoryIdempotentRepository, FileIdempotentRepository, HazelcastIdempotentRepository, JCacheIdempotentRepository, InfinispanIdempotentRepository, etc...).

For more detailed reading please refer to below links:

https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.2/html/Apache_Camel_Development_Guide/MsgEnd-Idempotent.html

http://people.apache.org/~dkulp/camel/idempotent-consumer.html

Coming back to your questions:

I'm trying to get the msg with the latest offset in kafka. Can this be used to get that? 'KafkaIdempotentRepository' If not what's the use of it?

In my personal opinion, I don't think KafkaIdempotentRepository is meant to serve this use case.

Kafka does guarantee ordering which means message served will have the latest committed offset within a partition.

Upvotes: 2

Related Questions