You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by João Rodrigues <jl...@gmail.com> on 2014/06/05 00:59:19 UTC

AdviceWithRouteBuilder.weaveById() creates duplicated endpoint

I've noticed the weaveById() creates a duplicated endpoint if there's a
"choice" in my camel route.
I'm running camel 2.12.3 with java 1.7.0_55.

I've built a test case to demonstrate this issue:
git clone https://github.com/joaocenoura/sandbox.git
mvn clean package -f sandbox/camel-weaving/pom.xml

There are two junit test with the following routes:
GoodRouteTest

from("direct:start").id("start")
  .to("mock:checkpoint").id("checkpoint")
  .to("mock:end").id("end");


BadRouteTest

from("direct:start").id("start")
  .setHeader("hello", constant("world"))
  .choice()
  .when(header("hello").isEqualTo("world"))
  .to("mock:checkpoint").id("checkpoint")
  .endChoice()
  .otherwise()
  // this shouldn't be called
  .to("mock:deadend").id("deadend")
  .end()
  .to("mock:end").id("end");


The BadRouteTest just introduces the choice/when/otherwise.
The problem is when I add a AdviseWithRouteBuilder with
'weaveById("checkpoint").before().to("mock:checkpoint.before");' it creates
2 endpoints instead of one. I've noticed the logs of junit confirms that.

Excerpt of GoodRouteTest logs:
23:44:45,644 INFO             -            - AdviceWithTasks
 - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> before [pipeline ->
[[To[mock:checkpoint.before]]]]
23:44:45,644 INFO             -            - AdviceWithTasks
 - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> after [pipeline ->
[[To[mock:checkpoint.after]]]]

Excerpt of BadRouteTest logs:
23:44:45,740 INFO             -            - AdviceWithTasks
 - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> before [pipeline ->
[[To[mock:checkpoint.before]]]]
23:44:45,740 INFO             -            - AdviceWithTasks
 - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> before [pipeline ->
[[To[mock:checkpoint.before]]]]
23:44:45,740 INFO             -            - AdviceWithTasks
 - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> after [pipeline ->
[[To[mock:checkpoint.after]]]]
23:44:45,740 INFO             -            - AdviceWithTasks
 - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> after [pipeline ->
[[To[mock:checkpoint.after]]]]


Is this a bug or am I doing something wrong?

Re: AdviceWithRouteBuilder.weaveById() creates duplicated endpoint

Posted by João Rodrigues <jl...@gmail.com>.
Hi Claus,
I've submitted the JIRA ticket:
https://issues.apache.org/jira/browse/CAMEL-7485 (hope its ok, that's my
first ticket here at ASF).
I've just updated the test case to include weaveByToString (same behavior
of weaveById).

Thanks



On Fri, Jun 6, 2014 at 2:20 PM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> Feel free to log a JIRA ticket
> http://camel.apache.org/support
>
> Also maybe try some of the other weaveByXXX to see if any of those works.
>
> On Thu, Jun 5, 2014 at 4:40 PM, João Rodrigues
> <jl...@gmail.com> wrote:
> > Hi,
> > I've tried camel 2.13.0 and it shows the same symptoms.
> >
> > Thanks
> >
> >
> > On Wed, Jun 4, 2014 at 11:59 PM, João Rodrigues <
> jlrodrigues.dev@gmail.com>
> > wrote:
> >
> >> I've noticed the weaveById() creates a duplicated endpoint if there's a
> >> "choice" in my camel route.
> >> I'm running camel 2.12.3 with java 1.7.0_55.
> >>
> >> I've built a test case to demonstrate this issue:
> >> git clone https://github.com/joaocenoura/sandbox.git
> >> mvn clean package -f sandbox/camel-weaving/pom.xml
> >>
> >> There are two junit test with the following routes:
> >> GoodRouteTest
> >>
> >> from("direct:start").id("start")
> >>   .to("mock:checkpoint").id("checkpoint")
> >>   .to("mock:end").id("end");
> >>
> >>
> >> BadRouteTest
> >>
> >> from("direct:start").id("start")
> >>   .setHeader("hello", constant("world"))
> >>   .choice()
> >>   .when(header("hello").isEqualTo("world"))
> >>   .to("mock:checkpoint").id("checkpoint")
> >>   .endChoice()
> >>   .otherwise()
> >>   // this shouldn't be called
> >>   .to("mock:deadend").id("deadend")
> >>   .end()
> >>   .to("mock:end").id("end");
> >>
> >>
> >> The BadRouteTest just introduces the choice/when/otherwise.
> >> The problem is when I add a AdviseWithRouteBuilder with
> >> 'weaveById("checkpoint").before().to("mock:checkpoint.before");' it
> creates
> >> 2 endpoints instead of one. I've noticed the logs of junit confirms
> that.
> >>
> >> Excerpt of GoodRouteTest logs:
> >> 23:44:45,644 INFO             -            - AdviceWithTasks
> >>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> before [pipeline
> ->
> >> [[To[mock:checkpoint.before]]]]
> >> 23:44:45,644 INFO             -            - AdviceWithTasks
> >>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> after [pipeline
> ->
> >> [[To[mock:checkpoint.after]]]]
> >>
> >> Excerpt of BadRouteTest logs:
> >> 23:44:45,740 INFO             -            - AdviceWithTasks
> >>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> before [pipeline
> ->
> >> [[To[mock:checkpoint.before]]]]
> >> 23:44:45,740 INFO             -            - AdviceWithTasks
> >>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> before [pipeline
> ->
> >> [[To[mock:checkpoint.before]]]]
> >> 23:44:45,740 INFO             -            - AdviceWithTasks
> >>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> after [pipeline
> ->
> >> [[To[mock:checkpoint.after]]]]
> >> 23:44:45,740 INFO             -            - AdviceWithTasks
> >>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> after [pipeline
> ->
> >> [[To[mock:checkpoint.after]]]]
> >>
> >>
> >> Is this a bug or am I doing something wrong?
> >>
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/
>

Re: AdviceWithRouteBuilder.weaveById() creates duplicated endpoint

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Feel free to log a JIRA ticket
http://camel.apache.org/support

Also maybe try some of the other weaveByXXX to see if any of those works.

On Thu, Jun 5, 2014 at 4:40 PM, João Rodrigues
<jl...@gmail.com> wrote:
> Hi,
> I've tried camel 2.13.0 and it shows the same symptoms.
>
> Thanks
>
>
> On Wed, Jun 4, 2014 at 11:59 PM, João Rodrigues <jl...@gmail.com>
> wrote:
>
>> I've noticed the weaveById() creates a duplicated endpoint if there's a
>> "choice" in my camel route.
>> I'm running camel 2.12.3 with java 1.7.0_55.
>>
>> I've built a test case to demonstrate this issue:
>> git clone https://github.com/joaocenoura/sandbox.git
>> mvn clean package -f sandbox/camel-weaving/pom.xml
>>
>> There are two junit test with the following routes:
>> GoodRouteTest
>>
>> from("direct:start").id("start")
>>   .to("mock:checkpoint").id("checkpoint")
>>   .to("mock:end").id("end");
>>
>>
>> BadRouteTest
>>
>> from("direct:start").id("start")
>>   .setHeader("hello", constant("world"))
>>   .choice()
>>   .when(header("hello").isEqualTo("world"))
>>   .to("mock:checkpoint").id("checkpoint")
>>   .endChoice()
>>   .otherwise()
>>   // this shouldn't be called
>>   .to("mock:deadend").id("deadend")
>>   .end()
>>   .to("mock:end").id("end");
>>
>>
>> The BadRouteTest just introduces the choice/when/otherwise.
>> The problem is when I add a AdviseWithRouteBuilder with
>> 'weaveById("checkpoint").before().to("mock:checkpoint.before");' it creates
>> 2 endpoints instead of one. I've noticed the logs of junit confirms that.
>>
>> Excerpt of GoodRouteTest logs:
>> 23:44:45,644 INFO             -            - AdviceWithTasks
>>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> before [pipeline ->
>> [[To[mock:checkpoint.before]]]]
>> 23:44:45,644 INFO             -            - AdviceWithTasks
>>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> after [pipeline ->
>> [[To[mock:checkpoint.after]]]]
>>
>> Excerpt of BadRouteTest logs:
>> 23:44:45,740 INFO             -            - AdviceWithTasks
>>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> before [pipeline ->
>> [[To[mock:checkpoint.before]]]]
>> 23:44:45,740 INFO             -            - AdviceWithTasks
>>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> before [pipeline ->
>> [[To[mock:checkpoint.before]]]]
>> 23:44:45,740 INFO             -            - AdviceWithTasks
>>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> after [pipeline ->
>> [[To[mock:checkpoint.after]]]]
>> 23:44:45,740 INFO             -            - AdviceWithTasks
>>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> after [pipeline ->
>> [[To[mock:checkpoint.after]]]]
>>
>>
>> Is this a bug or am I doing something wrong?
>>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: AdviceWithRouteBuilder.weaveById() creates duplicated endpoint

Posted by João Rodrigues <jl...@gmail.com>.
Hi,
I've tried camel 2.13.0 and it shows the same symptoms.

Thanks


On Wed, Jun 4, 2014 at 11:59 PM, João Rodrigues <jl...@gmail.com>
wrote:

> I've noticed the weaveById() creates a duplicated endpoint if there's a
> "choice" in my camel route.
> I'm running camel 2.12.3 with java 1.7.0_55.
>
> I've built a test case to demonstrate this issue:
> git clone https://github.com/joaocenoura/sandbox.git
> mvn clean package -f sandbox/camel-weaving/pom.xml
>
> There are two junit test with the following routes:
> GoodRouteTest
>
> from("direct:start").id("start")
>   .to("mock:checkpoint").id("checkpoint")
>   .to("mock:end").id("end");
>
>
> BadRouteTest
>
> from("direct:start").id("start")
>   .setHeader("hello", constant("world"))
>   .choice()
>   .when(header("hello").isEqualTo("world"))
>   .to("mock:checkpoint").id("checkpoint")
>   .endChoice()
>   .otherwise()
>   // this shouldn't be called
>   .to("mock:deadend").id("deadend")
>   .end()
>   .to("mock:end").id("end");
>
>
> The BadRouteTest just introduces the choice/when/otherwise.
> The problem is when I add a AdviseWithRouteBuilder with
> 'weaveById("checkpoint").before().to("mock:checkpoint.before");' it creates
> 2 endpoints instead of one. I've noticed the logs of junit confirms that.
>
> Excerpt of GoodRouteTest logs:
> 23:44:45,644 INFO             -            - AdviceWithTasks
>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> before [pipeline ->
> [[To[mock:checkpoint.before]]]]
> 23:44:45,644 INFO             -            - AdviceWithTasks
>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> after [pipeline ->
> [[To[mock:checkpoint.after]]]]
>
> Excerpt of BadRouteTest logs:
> 23:44:45,740 INFO             -            - AdviceWithTasks
>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> before [pipeline ->
> [[To[mock:checkpoint.before]]]]
> 23:44:45,740 INFO             -            - AdviceWithTasks
>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> before [pipeline ->
> [[To[mock:checkpoint.before]]]]
> 23:44:45,740 INFO             -            - AdviceWithTasks
>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> after [pipeline ->
> [[To[mock:checkpoint.after]]]]
> 23:44:45,740 INFO             -            - AdviceWithTasks
>  - AdviceWith (checkpoint) : [To[mock:checkpoint]] --> after [pipeline ->
> [[To[mock:checkpoint.after]]]]
>
>
> Is this a bug or am I doing something wrong?
>