MuleESB / Apache Camel Interview Questions
How does the Idempotent Consumer EIP work and what idempotent repositories does Camel support?
The Idempotent Consumer deduplicates messages by tracking message IDs in a repository. If a message with the same ID is received again (e.g., after a retry or redelivery), it is silently dropped, ensuring each logical message is processed exactly once.
// In-memory repository (dev/testing):
from("jms:queue:payments")
.idempotentConsumer(header("JMSMessageID"),
MemoryIdempotentRepository.memoryIdempotentRepository(5000))
.to("direct:processPayment");
// JDBC repository (production, survives restarts):
JdbcMessageIdRepository repo =
new JdbcMessageIdRepository(dataSource, "paymentRoute");
from("jms:queue:payments")
.idempotentConsumer(header("JMSMessageID"), repo)
.to("direct:processPayment");
// Infinispan (distributed cache for clusters):
InfinispanIdempotentRepository infinispanRepo = ...
from("kafka:topic:payments?brokers=k:9092")
.idempotentConsumer(header("kafka.KEY"), infinispanRepo)
.to("direct:process");Camel supports multiple idempotent repository implementations: MemoryIdempotentRepository (in-memory, non-persistent), JdbcMessageIdRepository (persistent via JDBC), JpaMessageIdRepository (JPA), InfinispanIdempotentRepository (distributed cache), and HazelcastIdempotentRepository (Hazelcast). The repository stores message IDs for a configurable TTL or indefinitely.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
