How to access Default Idempotent Repository map from java dsl?

一世执手 提交于 2019-12-24 02:54:47

问题


I am newbie to Apache Camel. How can i access Camel Default Idempotent Repository map in Java DSL.

Route:

from("file://C:/folderA?noop=true")
.to("file://C:/folderB")
.end();

When i say noop=true in route, then idempotent will be true. Now i need to get Idempotent map in java dsl. Please tell me how to access this?

Thanks in advance.


回答1:


If you want to access the underlying map, you should specify your own idempotentRepository bean. Using the existing MemoryIdempotentRepository should be pretty easy.

//Instantiate repository and get map
IdempotentRepository<String> repo = MemoryIdempotentRepository.memoryIdempotentRepository()
Map<String, Object> map = repo.getCache();

//Bind the repo to the Camel Context Registry using the id "repo"
//This changes depending upon how you are running Camel

//In your RouteBuilder...
from("file://C:/folderA?noop=true&idempotentRepository=#repo")
  .to("file://C:/folderB")
  .end();


来源:https://stackoverflow.com/questions/30758934/how-to-access-default-idempotent-repository-map-from-java-dsl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!