2014-02-11 36 views
0

我有這樣的代碼對我的路由器類呼籲過濾器標籤Apache的駱駝一類新的

from("seda:singleInvoicesChannel") 
       .filter(new LowEnoughAmountPredicate()) 
       .to("seda:filteredInvoicesChannel"); 

現在IAM試圖把它與這個

<route id="singleInvoicesChannel"> 
      <from uri="seda:singleInvoicesChannel"/> 
      <filter> 

      </filter> 
      <to uri="seda:filteredInvoicesChannel"/> 
     </route> 

轉移對我的駱駝的context.xml我問題是我將在過濾器標籤中放置什麼來實現.filter(新的LowEnoughAmountPredicate());.

+0

可能重複[如何在Spring XML中使用駱駝消息過濾Bean](http://stackoverflow.com/questions/21762743/how-to-use-camel-message-filter-bean-in-spring-xml) – hveiga

回答

0

我不是這個Springish DSL的球迷,但我只是想這可能是這樣的:

<bean id="filterBean" class="LowEnoughAmountPredicate"/> 

    <route id="singleInvoicesChannel"> 
     <from uri="seda:singleInvoicesChannel"/> 
     <filter> 
     <custom ref="filterBean" /> 
     </filter> 
     <to uri="seda:filteredInvoicesChannel"/> 
    </route> 
0

工作彈簧解決方案看起來像這樣:的

<bean id="myPredicate" class="LowEnoughAmountPredicate"/> 

    <route id="singleInvoicesChannel"> 
     <from uri="seda:singleInvoicesChannel"/> 
     <filter> 
     <method ref="myPredicate"/> 
     <to uri="seda:filteredInvoicesChannel"/> 
     </filter> 
    </route>