[英]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.