Details
Description
While setting up a route template, if you use a parameter named like an environment variable, camel resolves first the environment variable and ignores the value of the parameter set using the TemplateRouteBuilder.
Here follows a short program that exhibit this behaviour (this code is also attached to this issue as "sample_code.txt")
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.builder.TemplatedRouteBuilder;
import org.apache.camel.main.ConfigureRouteTemplates;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Main {
public static final Logger LOG = LoggerFactory.getLogger(Main.class);
public static class MyRouteBuilder extends RouteBuilder {
public void configure() throws Exception {
routeTemplate("myTemplate")
.templateParameter("name")
.templateParameter("path")
.templateParameter("myPeriod", "3s")
.from("timer:{{name}}?period={{myPeriod}}")
.log("{{path}}");
}
}
public static class MyTemplateBuilder implements ConfigureRouteTemplates {
public void configure(CamelContext context)
}
public static void main(String[] args) throws Exception
}
This sample code, when run with Camell 3.11.1 or 3.11.5, outputs the content of the PATH variable.
If you run it with Camel 3.14.0, it outputs "test path".
Attachments
Attachments
Issue Links
- duplicates
-
CAMEL-16788 camel-kamelet - Local parameters get overridden by environment variable
- Resolved