camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karthz <skart...@gmail.com>
Subject InterceptSendToEndpoint - Http Component
Date Tue, 07 Dec 2010 22:19:47 GMT

Hi,

I'm using Camel 2.5. And, this is an outline of what I'm trying to do,

        <camel:interceptSendToEndpoint uri="{{custom.url}}"
inheritErrorHandler="true">
            <camel:doTry>
                <camel:to uri="bean:xyz?method=throwException" />
                <camel:doCatch>
                   
<camel:exception>java.lang.IllegalArgumentException</camel:exception>
                    <camel:log message="Message Failure" />
                    <camel:stop />
                </camel:doCatch>
            </camel:doTry>
        </camel:interceptSendToEndpoint>

        <camel:route id="route1">
            <camel:from uri="direct:something" />
            <camel:to uri="bean:xyz?method=doNothing" />
            <camel:to uri="{{custom.url}}" />
            <camel:log message="Message Success" />
        </camel:route>

Looks like there's an issue while intercepting messages sent to a Http
Component. It gets intercepted correctly, and "Message Failure" gets printed
in the logs correctly too.  However, the message still gets sent to the Http
component anyway. [Note: the  "Message Success", however, doesn't get
printed in the logs.]

This behavior remains even if I use
               <camel:interceptSendToEndpoint uri="http*"
inheritErrorHandler="true">
AND/OR the actual http url, instead of the placeholder
               <camel:to uri="http://localhost:8080/test" />

But if I intercept something else, and not the http component, then it works
fine. In the above route, this change
               <camel:interceptSendToEndpoint
uri="bean:xyz?method=doNothing" inheritErrorHandler="true">
does exactly what I want it to do. It intercepts before the method, and the
method never gets executed in case of an exception.


So, what's the correct way to intercept something that's being sent to a
Http Component?

Thanks.


-----
- Karthz
-- 
View this message in context: http://camel.465427.n5.nabble.com/InterceptSendToEndpoint-Http-Component-tp3296620p3296620.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message