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.git


The following commit(s) were added to refs/heads/main by this push:
     new 1bcbdc5865f CAMEL-18262: Polished
1bcbdc5865f is described below

commit 1bcbdc5865fcbf3729af126604082579ccbccafc
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Mon Jul 25 17:01:36 2022 +0200

    CAMEL-18262: Polished
---
 .../src/main/java/org/apache/camel/impl/DefaultModel.java          | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java 
b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java
index 793c29fa05b..477b67a62fa 100644
--- 
a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java
+++ 
b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java
@@ -417,12 +417,15 @@ public class DefaultModel implements Model {
                     "duplicate id detected: " + duplicate + ". Please correct 
ids to be unique among all your routes.");
         }
 
-        addRouteDefinition(def);
-
+        // must use route collection to prepare the created route to
+        // ensure its created correctly from the route template
         RoutesDefinition routeCollection = new RoutesDefinition();
         routeCollection.setCamelContext(camelContext);
         routeCollection.setRoutes(getRouteDefinitions());
         routeCollection.prepareRoute(def);
+
+        // add route and return the id it was assigned
+        addRouteDefinition(def);
         return def.getId();
     }
 

Reply via email to