{{announcement.body}}
{{announcement.title}}

How to Empty Cache memoryIdempotentRepository in Apache Camel (DSL Java)

DZone 's Guide to

How to Empty Cache memoryIdempotentRepository in Apache Camel (DSL Java)

In this article, we provide a brief tutorial on how to clear the cache memoryIdempotentRepository in an Apache Camel application.

· Java Zone ·
Free Resource

In this article, we provide a brief tutorial on how to clear the cache memoryIdempotentRepository in an Apache Camel Application.

The Enterprise Integration Pattern (EIP)  IdempotentConsumer implemented by Apache Camel filters out duplicate exchange messages. This process requires cache. Camel implements different kinds of cache, such as the MemoryIdempotentRepository [1]. 

The MemoryIdempotentRepository is a very fast in-memory store that stores entries in a map structure. Data will be lost when the JVM shuts down. However, it may be the case that you want to delete the cache before or without shutting down the JVM. 

To clear the cache you can use clear() defined in MemoryIdempotentRepository.java

The following processor clears a MemoryIdempotentRepository (here named TEMP_CACHE):

Java

 

 [1] https://camel.apache.org/manual/latest/idempotentConsumer-eip.html..


Further Reading

Topics:
apache camel ,cache ,clearing ,java ,java dsl

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}