Preventing duplicate invocation of routing logic

When dealing with external systems, it is often necessary to ensure that the same request is not sent multiple times—a process often called deduplication.

Camel implements the Idempotent Consumer EIP, which allows you to mark a segment of a route as callable only once for each unique message. This is useful if it is possible for your route to receive duplicate messages, either from an upstream system or from the underlying infrastructure (for example, through a message queue configured for redelivery on failure), and you want to protect routing logic that is intolerant of duplicates.

This recipe explains how to make portions of your route idempotent in Camel.

Getting ready

The Java code for this recipe ...

Get Apache Camel Developer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.