简体   繁体   中英

calling a new class on filter tag apache camel

I have this code on my router class

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

now iam trying to transfer it on my camel-context.xml with this

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

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

my question is what will i put inside the filter tag to fulfill the .filter(new LowEnoughAmountPredicate());.

I'm not fan of this Springish DSL but I just guess it could be something like this:

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

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

The working Spring solution looks like that:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM