Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-20545

AdviceWith -> replaceFromWith fails when using several templated routes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.4.0
    • 4.5.0
    • camel-test
    • None
    • Unknown

    Description

      Given the following route template

      routeTemplate("myRouteTemplate")
                      .templateParameter("message")
                      .from("timer:myTimer?period=5000")
                      .log("{{message}}");
      

      And given the following two routes based on that template

       

      templatedRoute("myRouteTemplate")
                      .parameter("message", "hello from first template")
                      .routeId("firstroute");
      templatedRoute("myRouteTemplate")
                      .parameter("message", "hello from second template")
                      .routeId("secondroute");
       
      

      a JUnit test annotated with

      @CamelMainTest(replaceRouteFromWith = {"firstroute=direct:start"})

      will fail with

      Failed to start route secondroute because of Multiple consumers for the same endpoint is not allowed: direct://start

      See https://github.com/thomas-gantenbein-tga/camel-advicewithtest/blob/master/src/test/java/com/acme/ReplaceFromWithAnnotationTest.java for such a JUnit test that will fail.

      The same happens with Spring Boot test, see https://github.com/thomas-gantenbein-tga/advicewithtest_springboot/blob/master/src/test/java/com/acme/WithAdviceWithAnnotationTest.java.

      Tests do pass when the context is already started when advising it, see https://github.com/thomas-gantenbein-tga/advicewithtest_springboot/blob/master/src/test/java/com/acme/NoAdviceWithAnnotationTest.java#L38.

       

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              ganteth Thomas Gantenbein
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: