Java 如何在springxml中使用Camel消息过滤器Bean

Java 如何在springxml中使用Camel消息过滤器Bean,java,configuration,filtering,apache-camel,imessagefilter,Java,Configuration,Filtering,Apache Camel,Imessagefilter,Camel显示了几个使用“过滤器bean”的Java DSL示例,如下所示: 但是该页面没有显示如何在SpringXML中调用该bean: <route id="my-route"> <from uri="direct:a" /> <filter> <method>??? how to call MyBean#isGoldCustomer from here???</method> <

Camel显示了几个使用“过滤器bean”的Java DSL示例,如下所示:

但是该页面没有显示如何在SpringXML中调用该bean:

<route id="my-route">
    <from uri="direct:a" />
    <filter>
        <method>??? how to call MyBean#isGoldCustomer from here???</method>
        <to uri="direct:b" />
    </filter>
</route>

??? 如何称呼MyBean?从这里是GoldCustomer吗???

在上面的代码片段中,我如何用Java bean连接我的
,以及该Java bean需要实现/扩展什么接口?

您应该能够这样做:

<bean id="myCustomPredicate" class="com.hveiga.test.MyCustomPredicate"/> 

<route id="my-route">
    <from uri="direct:a" />
    <filter>
        <method ref="myCustomPredicate" />
        <to uri="direct:b" />
    </filter>
</route>


<bean id="myCustomPredicate" class="com.hveiga.test.MyCustomPredicate"/> 

<route id="my-route">
    <from uri="direct:a" />
    <filter>
        <method ref="myCustomPredicate" />
        <to uri="direct:b" />
    </filter>
</route>
<bean id="myCustomPredicate" class="com.hveiga.test.MyCustomPredicate"/>
<route id="my-route">
    <from uri="direct:a" />
    <filter>
        <method ref="myCustomPredicate" method="myCustomPredicateMethod"/>
        <to uri="direct:b" />
    </filter>
</route>