Camel To Interceptor does not seem to work

312 views Asked by At

I have my camel routes deployed on ServiceMix and am trying to write simple interceptors PoC for encryption/decryption using camel interceptSendToEndpoint; but this does not seem to work for me ! Am I doing something wrong here ?

<blueprint>       
    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
        <routeBuilder ref="dynamicRouter" />
        <routeBuilder ref="inBundleRouter" />
        <routeBuilder ref="sqlRouter" />
        <routeBuilder ref="changeRouter" />
        <interceptSendToEndpoint uri="vm:changeRoute" inheritErrorHandler="true">
            <doTry>
            <to uri = "vm:outBundleRoute"/>
            <process ref = "printProcessor"/>  <!-- This would just print Exchange headers-->
            <doCatch>
                <exception>java.lang.Exception</exception>
                <log message="Message Failure" />
                <stop />
            </doCatch>
        </doTry>
        </interceptSendToEndpoint>
    </camelContext>
    <bean id="dynamicRouter" class="ex.route.DynamicRoute" />
    <bean id="inBundleRouter" class="ex.route.InBundleRoute" />
    <bean id="sqlRouter" class="ex.route.SQLRoute" />
    <bean id="changeRouter" class="ex.route.ChangeRoute" />
    <bean id="printProcessor" class="ex.processor.PrintProcessor" />
    <bean id="sqlProcessor" class="ex.processor.SQLProcessor" />
</blueprint>

This is the route I am trying to intercept.

public class InBundleRoute extends RouteBuilder{
    @Override
    public void configure() throws Exception {
        from("vm:inBundleRoute")
        //.processRef("printProcessor")
        .log("In vm:inBundleRoute")
        .to ("vm:changeRoute");
    }
}

I am hoping that this route should not get fired. But I am seeing this route is running

public class ChangeRoute extends RouteBuilder{
    @Override
    public void configure() throws Exception {
        from("vm:changeRoute")
        //.processRef("printProcessor")
        .log("In vm:changeRoute ")
        .to ("mock://acs");
    }
}
0

There are 0 answers