This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new 21918c8  CAMEL-16552: camel-spring-boot - Configuring route templates 
trouble setting route id when using spring yaml configuration
21918c8 is described below

commit 21918c8f30d5efe7c6fab6c47b405ae114e675f4
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Apr 27 12:09:04 2021 +0200

    CAMEL-16552: camel-spring-boot - Configuring route templates trouble 
setting route id when using spring yaml configuration
---
 .../CamelRouteTemplateAutoConfiguration.java              | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git 
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/routetemplate/CamelRouteTemplateAutoConfiguration.java
 
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/routetemplate/CamelRouteTemplateAutoConfiguration.java
index 437e73b..3fc76b7 100644
--- 
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/routetemplate/CamelRouteTemplateAutoConfiguration.java
+++ 
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/routetemplate/CamelRouteTemplateAutoConfiguration.java
@@ -43,10 +43,21 @@ public class CamelRouteTemplateAutoConfiguration {
         PropertiesRouteTemplateParametersSource source = new 
PropertiesRouteTemplateParametersSource();
         int counter = 0;
         for (Map<String, String> e : rt.getConfig()) {
+            boolean customRouteId = true;
+            String routeId = e.remove("routeId");
+            if (routeId == null) {
+                routeId = e.remove("route-id");
+            }
+            if (routeId == null) {
+                routeId = String.valueOf(counter);
+                customRouteId = false;
+            }
             for (Map.Entry<String, String> entry : e.entrySet()) {
-                source.addParameter(String.valueOf(counter), entry.getKey(), 
entry.getValue());
+                source.addParameter(routeId, entry.getKey(), entry.getValue());
+            }
+            if (!customRouteId) {
+                counter++;
             }
-            counter++;
         }
 
         
camelContext.getRegistry().bind("CamelSpringBootRouteTemplateParametersSource", 
RouteTemplateParameterSource.class, source);

Reply via email to