[ 
https://issues.apache.org/jira/browse/CAMEL-18922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17677050#comment-17677050
 ] 

Claus Ibsen commented on CAMEL-18922:
-------------------------------------

Okay I think I can see the bug.

You can use this to make it work

loader.loadRoutes(List.of(resource));

> TemplatedRoute fails to load with XML RouteLoader
> -------------------------------------------------
>
>                 Key: CAMEL-18922
>                 URL: https://issues.apache.org/jira/browse/CAMEL-18922
>             Project: Camel
>          Issue Type: Bug
>          Components: came-core
>    Affects Versions: 3.20.1
>            Reporter: Raymond
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 3.20.2, 3.21.0, 4.0
>
>         Attachments: routeloader-with-routetemplate.7z, 
> routeloader-with-routetemplate.zip
>
>
> 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:
> {code:java}
> // 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()); {code}
> 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).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to