簡體   English   中英

在過濾器標簽apache駱駝上調用新類

[英]calling a new class on filter tag apache camel

我的路由器類上有此代碼

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

現在我試圖與此轉移到我的camel-context.xml

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

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

我的問題是我將在filter標記內放入什么以實現.filter(new LowEnoughAmountPredicate());。

我不喜歡這種Springish DSL,但我只是猜測可能是這樣的:

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

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

正常的Spring解決方案如下所示:

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM