You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Martin Krasser <de...@martin-krasser.de> on 2009/10/12 18:47:00 UTC

Issue with interceptSendToEndpoint

When I send a message to "direct:test1" in the following route builder, the
"hello" is written three-times to the console instead of only once, as
expected.

interceptSendToEndpoint("direct:intercept")
.process(new Processor() {
    public void process(Exchange exchange) throws Exception {
        System.out.println("hello");
    }
});

from("direct:test1").to("direct:intercept");
from("direct:test2").to("direct:intercept");
from("direct:test3").to("direct:intercept");

The problem is that the "direct:intercept" endpoint is proxied/decorated
several times with an InterceptSendToEndpoint object, depending on the
number of to("direct:intercept") in the route builder.

One possible bugfix for this problem is to decorate the original endpoint
only if it's not already decorated (special handling in
InterceptSendToEndpoint class), but I'm not sure if this is the best
solution. If this sounds reasonable I can provide a patch.

Cheers,
Martin
-- 
View this message in context: http://www.nabble.com/Issue-with-interceptSendToEndpoint-tp25859201p25859201.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Issue with interceptSendToEndpoint

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Oct 12, 2009 at 6:47 PM, Martin Krasser <de...@martin-krasser.de> wrote:
>
> When I send a message to "direct:test1" in the following route builder, the
> "hello" is written three-times to the console instead of only once, as
> expected.
>
> interceptSendToEndpoint("direct:intercept")
> .process(new Processor() {
>    public void process(Exchange exchange) throws Exception {
>        System.out.println("hello");
>    }
> });
>
> from("direct:test1").to("direct:intercept");
> from("direct:test2").to("direct:intercept");
> from("direct:test3").to("direct:intercept");
>
> The problem is that the "direct:intercept" endpoint is proxied/decorated
> several times with an InterceptSendToEndpoint object, depending on the
> number of to("direct:intercept") in the route builder.
>
> One possible bugfix for this problem is to decorate the original endpoint
> only if it's not already decorated (special handling in
> InterceptSendToEndpoint class), but I'm not sure if this is the best
> solution. If this sounds reasonable I can provide a patch.
>

Yeah it looks as it should only do it once per given endpoint.
Please create a ticket and provide a patch.


> Cheers,
> Martin
> --
> View this message in context: http://www.nabble.com/Issue-with-interceptSendToEndpoint-tp25859201p25859201.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus