2017-04-20 4 views
0

Apache Camel과 함께 등록 정보 파일을 사용하여 구성 가능한 등록 정보를 참조하는 방법. 예를 들어, 폴더에서 파일을 읽는 경로가있는 경우 해당 폴더 위치를 등록 정보 파일에서 어떻게 구성 할 수 있습니까? Java DSL을 사용하고 있습니다.Apache Camel에서 등록 정보 파일 사용

답변

3

Camel에는 광범위한 속성이 있습니다.

PropertiesComponent pc = new PropertiesComponent(); 
pc.setLocation("classpath:com/mycompany/myprop.properties"); 
context.addComponent("properties", pc); 

myprop.properties : 다음을 수행 할 수있는 매우 간단한 경우에서

route.start=file:///tmp/myfile 
route.to=direct:whatever 

그리고 경로에 당신은 속성을 참조하는 {{..}} 자리 구문을 사용할 수 있습니다.

from("{{route.start}}") 
    .split() 
    .process(whatever) 
    .to("{{route.to}}") 

스프링을 사용하고 있으며 속성 파일이 이미로드 된 경우 속성 구성 요소 정의를 건너 뛰고 속성을 직접 참조 할 수 있습니다.

자세한 내용은 documentation을 읽으십시오.