camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: InterceptSendToEndpoint - Http Component
Date Wed, 08 Dec 2010 05:31:59 GMT
Hi

There is an attribute on the <interceptSendToEndpoint>
skipSendToOriginalEndpoint which you should set to true if you dont
want to send the message that was intercepted.

BTW: You IDE may assist you and show code completion etc. when editing
the XML files as its a good idea to see which attributes and whatnot
the XSD schema provides out of the box.


On Tue, Dec 7, 2010 at 11:19 PM, Karthz <skarthz1@gmail.com> wrote:
>
> 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.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message