Vaibhav Bhootna
Vaibhav Bhootna

Reputation: 176

How to intercept camel:to endpoint when using ref instead of uri?

<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>

This is a sample code and I have a big project and everywhere we are using like this

<to ref="callService"/> 

and I don't want to change the existing code.

Upvotes: 1

Views: 1041

Answers (1)

Gnana Guru
Gnana Guru

Reputation: 715

You can use camel ref component to look up existing endpoint bound in the registry.

One simple use case is, If you want to reuse an endpoint across the board, you can have your endpoint defined in the registry level and which can be referred in your camel routes by ref component.

Reference: http://camel.apache.org/ref.html

Hope it helps !!

Upvotes: 1

Related Questions