You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Raymond (Jira)" <ji...@apache.org> on 2023/01/14 14:48:00 UTC

[jira] [Updated] (CAMEL-18922) TemplatedRoute fails to load with XML RouteLoader

     [ https://issues.apache.org/jira/browse/CAMEL-18922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raymond updated CAMEL-18922:
----------------------------
    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:
{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).

  was:
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 is on 3.19.0 the example works, and when it's on 3.20.0 is fails)


> 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
>            Priority: Major
>         Attachments: routeloader-with-routetemplate.7z
>
>
> 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)