2013-07-15 2 views
1

나는 다음과 같습니다 낙타 경로가 :낙타 RSS 구성 요소 및 선택 필터링

 from("rss:" + RSS_URL) 
     .marshal().rss() 
     .choice() 
      .when(xpath("//item/guid/text()[contains(.,'4552')]")) 
       .log("Cool") 
       .to("seda:end") 
      .otherwise() 
       .log("Other message") 
       .to("seda:end"); 

나는 정확히 하나의 메시지를 볼 수있는 로그를 확인하면

[example.com/feed/] route1 정보 다른 메시지

나는 filter 지시로 choice를 교체하고, 거기에 process를 던질 경우 내 필터가 작동하지 않습니다 :

 from("rss:" + RSS_URL) 
     .marshal().rss() 
     .filter().xpath("//item/guid/text()[contains(.,'4552')]") 
     .process(new Processor() { 
     @Override 
     public void process(Exchange exchange) throws Exception { 
      System.out.println("Got Here"); 
     } 
    }) 
     .to("seda:end"); 

확실하게, 제 콘솔에 "여기 있습니다"가 표시됩니다. 사정을 더 악화시키기 위해, 내가 log("Cool")으로 나의 process(...)을 바꾸면 나는 필터가 false와 일치했다는 것을 나타내는 로그에 메시지를 얻고 어디서나 "Cool"을 보지 못한다 ... 나는 그것을 얻지 못한다.

누구에게 무슨 일이 일어 났는지 알 수 있습니까?

답변

1

어떤 버전의 낙타를 사용하고 있습니까? endChoice() DSL을 사용하여 Choice 블록을 표시하려고 했습니까?

from("rss:" + RSS_URL) 
    .marshal().rss() 
    .choice() 
     .when(xpath("//item/guid/text()[contains(.,'4552')]")) 
      .log("Cool") 
      .to("seda:end") 
     .endChoice() 
     .otherwise() 
      .log("Other message") 
     .endChoice() 
     .to("seda:end"); 
+0

v2.11.1은 마샬링 한 후 본체가 바이트 문자열이고 dom이 아니기 때문에 가능할 수 있습니까? – ThaDon

+0

감사합니다. RSS_URL에서'endChoice()'와'? splitEntries = true'를 사용했는데 모든 차이를 만든 것처럼 보였습니다. – ThaDon

관련 문제