Apache Camel RedisIdempotentRepository Configurati

2019-07-04 11:59发布

问题:

Has anyone been able to successfully get RedisIdempotentRepository working in a Camel Route?

My Camel Route is built using Java 8+, Apache Camel (2.17.1) and Spring Boot (1.3.3.RELEASE). The Camel Route loads and processes messages but does not filter out duplicates:

from("activemq:generic.order").
idempotentConsumer(header("uniqueId"), 
RedisIdempotentRepository.redisIdempotentRepository(redisTemplate,"camel-repo")).
to("activemq:unique.order");

The RedisTemplate is connected to a local Redis Server(3.0.4) and is injected with a Redis Connection Pool.

I tested the same Camel Route using the in-memory repository and the messages were filtered out.

回答1:

RedisIdempotentRepository was not the problem. My Redis instance was corrupted. The solution above works :)