1

I am trying to use RedisIdempotentRepository as Idempotent Consumer for the camel Route. I tried with local Redis docker container and its working as expected with the following code.

IdempotentRepository redisIdempotentRepository = new RedisIdempotentRepository("redis");
from(source)
    .idempotentConsumer(simple("${in.header.CamelFileName}"), redisIdempotentRepository)
    .log("Uploading file ${file:name} started...")
    .to(destination)
    .log("Uploading file ${file:name} completed...");

Without providing any details, it is connecting to localhost:6379. How can i provide the ElastiCache details to connect for?

I tried these configurations (link1, link2) to build RedisTemplate and it is not able to connect.

Community
  • 1
  • 1
Gangaraju
  • 4,406
  • 9
  • 45
  • 77
  • You would need to tell more details about what error or what you see with - not able to connect. And check the unit tests of camel-spring-redis that can have some tests that can show you how to do it: https://github.com/apache/camel/tree/master/components/camel-spring-redis – Claus Ibsen Sep 29 '16 at 06:03
  • Thanks @ClausIbsen, It was a issue with AWS security groups. I dont have a clue earlier that a node was associated to a existing secuirty group. I thought it can be accessible across the VPC. – Gangaraju Sep 29 '16 at 06:56

1 Answers1

0

Its working now. I have added 6379 port in inbound rules for the redis node associated security group.

JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory();
jedisConnectionFactory.setHostName("<cluster-name>.mdbnso.0001.use1.cache.amazonaws.com");
jedisConnectionFactory.setPort(6379);
jedisConnectionFactory.afterPropertiesSet();

RedisTemplate redisTemplate = new RedisTemplate();
redisTemplate.setConnectionFactory(jedisConnectionFactory);
redisTemplate.afterPropertiesSet();

IdempotentRepository redisIdempotentRepository = new RedisIdempotentRepository(redisTemplate, "redis");

from(source)
    .idempotentConsumer(simple("${in.header.CamelFileName}"), redisIdempotentRepository)
    .log("Uploading file ${file:name} started...")
    .to(destination)
    .log("Uploading file ${file:name} completed...");
Gangaraju
  • 4,406
  • 9
  • 45
  • 77