2015-02-05 5 views
0

3 가지 기준에 따라 개체를 라우팅하려고합니다.사용자 지정 메서드가있는 낙타 라우팅

내 질문은 :

1) 이유는 즉, 객체를 라우팅는 임의의 방법으로 필터 중 하나에 가서 선형하지 않은 경우?

2) "선택 사항"과 "언제"로 작업 할 경우 어떻게 작동합니까 (예)? 사용자 지정 방법을 사용하여 라우팅 할 수 있습니까?

많은 감사 표시

이 예에서 필터에 사용하는 메신저와 같은 :

camelContext.addRoutes(new RouteBuilder() { 
@Override 
public void configure() throws Exception {         

    from("activemq:cfes.queue").filter().method(CustomCamelFilter.class, "methodOne") 
     .to("file://c:/u01/tomcat_conf/folder1");    

    from("activemq:cfes.queue").filter().method(CustomCamelFilter.class, "methodTwo") 
     .to("file://c:/u01/tomcat_conf/folder2"); 

    from("activemq:cfes.queue").filter().method(CustomCamelFilter.class, "methodThree") 
     .to("file://c:/u01/tomcat_conf/folder3"); 

답변

0

여기에 .filter() 패턴을 사용하는 잘못, 그 대신 .choice() 패턴을 사용한다 정말로 당신을 보인다 때, 이렇게 :

.choice() 
    .when(method(MyBean.class, "methodOne")).log("HELLO1") 
    .when(method(MyBean.class, "methodTwo")).log("HELLO2") 
    .when(method(MyBean.class, "methodThree")).log("HELLO3") 
    .otherwise().log("OOPS!") 
.end() 
+0

정확하게 내가 필요한 것. 감사합니다 – rogerbax

+0

걱정하지 마시고 언제든 환영합니다. – vikingsteve

관련 문제