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 9a2dbcc67b8 CAMEL-18262 - Fixing the Template issue (#7995)
9a2dbcc67b8 is described below
commit 9a2dbcc67b8525fb8678c8d906f582c56c1daa13
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Jul 27 07:17:15 2022 +0200
CAMEL-18262 - Fixing the Template issue (#7995)
---
.../java/org/apache/camel/component/kamelet/KameletComponent.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git
a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java
b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java
index aae39ca3c24..054b383ffcc 100644
---
a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java
+++
b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java
@@ -29,6 +29,7 @@ import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.Processor;
import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.ServiceStatus;
import org.apache.camel.VetoCamelContextStartException;
import org.apache.camel.model.ModelCamelContext;
import org.apache.camel.model.RouteDefinition;
@@ -401,7 +402,10 @@ public class KameletComponent extends DefaultComponent {
String id = context.addRouteFromTemplate(routeId, templateId,
endpoint.getKameletProperties());
RouteDefinition def = context.getRouteDefinition(id);
- if (!def.isPrepared()) {
+ // start the route if not already started
+ ServiceStatus status =
context.getRouteController().getRouteStatus(id);
+ boolean started = status != null && status.isStarted();
+ if (!started) {
context.startRouteDefinitions(Collections.singletonList(def));
}