Idempotency inside transactions

This recipe will show you how to wire up an idempotent consumer that uses a database as its repository for previously seen messages, within a route that uses transaction management with that same database.

This setup is used so that the persistence of message IDs by an idempotent consumer is not affected by the results of any database transactions in progress within the same route.

The net effect is a combination of the behaviors that we have already seen in the Using transactions with a database and Preventing duplicate invocation of routing logic recipes.

Getting ready

The Java code for this recipe is located in the org.camelcookbook.transactions.idempotentconsumerintransaction package. The Spring XML files are located ...

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.