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

TemplatedRoute fails to load with XML RouteLoader

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.20.1
    • 3.20.2, 3.21.0, 4.0-M1, 4.0.0
    • came-core
    • None
    • Unknown

    Description

      I created the following ticket yesterday:

      https://issues.apache.org/jira/browse/CAMEL-18914

      This issue was not a bug as it was a problem with the namespace.

      I am creating a new ticket as the route template still doesn't load in 3.20.0 (In 3.19.0 it loads successfully).

      Here is the code I am using:

      // 1. Start Camel
      context = new DefaultCamelContext();
      context.start();
      
      //2. Load route template
      context.addRoutes((RouteBuilder) new MyTemplate());
      
      //3. Create resource from string
      String content = "<templatedRoutes id=\"camel\" xmlns=\"http://camel.apache.org/schema/spring\">\n" +
              "    <!-- create two routes from the template -->\n" +
              "    <templatedRoute routeTemplateRef=\"myTemplate\">\n" +
              "        <parameter name=\"name\" value=\"Manually Loaded Tempate\"/>\n" +
              "        <parameter name=\"greeting\" value=\"Hello\"/>\n" +
              "    </templatedRoute>\n" +
              "</templatedRoutes>";
      
      Resource resource = ResourceHelper.fromString("in-memory.xml", content);
      
      //4. Load resource
      ExtendedCamelContext extendedCamelContext = context.adapt(ExtendedCamelContext.class);
      RoutesLoader loader = extendedCamelContext.getRoutesLoader();
      loader.loadRoutes(resource);
      
      //5. check the size of all routes
      LOG.info("RoutesSize = " + context.getRoutesSize()); 

      I added an example to reproduce this issue. When Camel version 3.19.0 is used the example works. When version 3.20.0 is used it fails. The example is configured with 3.19.0 (as the bom version).

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            skin27 Raymond
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: