2016-09-28 7 views
1

私はRedisIdempotentRepositoryIdempotent Consumerとしてラクダルートに使用しようとしています。私は地元のレディスドッカーのコンテナを試して、次のコードで期待どおりに動作していました。ElastiCacheをCamel Idempotent Repositoryとして使用するには?

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..."); 

localhost:6379に接続しています。どのように接続するためにElastiCacheの詳細を提供できますか?

RedisTemplateをビルドするためにこれらの設定(link1link2)を試してみましたが、接続できませんでした。

+0

あなたは、どのようなエラーや見ているものが接続できないのかについてもっと詳しく説明する必要があります。そして、あなたにそれを行う方法を示すことができるいくつかのテストをすることができるcamel-spring-redisの単体テストを確認してください:https://github.com/apache/camel/tree/master/components/camel-spring-redis –

+0

ありがとう@ClausIbsen、AWSセキュリティグループの問題でした。以前はノードが既存のsecuirtyグループに関連付けられていたという手掛かりはありません。私はそれがVPCを通してアクセス可能であると思った。 – Gangaraju

答えて

0

現在作業中です。私は、レディスノード関連のセキュリティグループの受信規則に6379ポートを追加しました。

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..."); 
関連する問題