Apache camel 如何在使用ref而不是uri时拦截camel:to端点?

Apache camel 如何在使用ref而不是uri时拦截camel:to端点?,apache-camel,soa,jbossfuse,apache-servicemix,Apache Camel,Soa,Jbossfuse,Apache Servicemix,这是一个示例代码,我有一个大项目,我们在任何地方都像这样使用 <cxf:cxfEndpoint id="cxfEndpnt" address="http://localhost:8088/mockDownloadService" wsdlURL="D:\workspaces\sdpwrk\vaibhav-test\src\main\resources\META-INF\downloadService\DownloadServices.wsdl"> <cxf:pr

这是一个示例代码,我有一个大项目,我们在任何地方都像这样使用

<cxf:cxfEndpoint id="cxfEndpnt" address="http://localhost:8088/mockDownloadService"
    wsdlURL="D:\workspaces\sdpwrk\vaibhav-test\src\main\resources\META-INF\downloadService\DownloadServices.wsdl">
    <cxf:properties>
        <entry key="dataFormat" value="PAYLOAD" />
    </cxf:properties>
</cxf:cxfEndpoint>

<camelContext id="dest_context" xmlns="http://camel.apache.org/schema/spring"
    handleFault="true">

    <interceptSendToEndpoint uri="cxfEndpnt"
        skipSendToOriginalEndpoint="false">
        <camel:bean ref="testBean" method="testMethod"></camel:bean>
    </interceptSendToEndpoint>

    <route>
        <from uri="direct:testInterceptor" />

        <!-- Able to intercept -->
        <to uri="cxfEndpnt"/>
         <!-- Not Able to intercept -->
        <to ref="cxfEndpnt"/>

    </route>


我不想更改现有代码。

您可以使用camel ref组件在注册表中查找现有的端点绑定

一个简单的用例是,如果您想全面重用端点,您可以在注册表级别定义端点,并且可以在您的camel routes by ref组件中引用端点

参考:


希望能有帮助

ref已被弃用,在Camel 3.0中,您应该改用uri=“ref:xxx”。
<to ref="callService"/>