CAMEL-15940: camel-spring-boot - Issue with property placeholder in an example
diff --git a/camel-example-spring-boot-clustered-route-controller/cluster-node/pom.xml b/camel-example-spring-boot-clustered-route-controller/cluster-node/pom.xml
index 28a4f43..8216eac 100644
--- a/camel-example-spring-boot-clustered-route-controller/cluster-node/pom.xml
+++ b/camel-example-spring-boot-clustered-route-controller/cluster-node/pom.xml
@@ -54,18 +54,8 @@
<dependencies>
<dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-tomcat</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-undertow</artifactId>
+ <groupId>org.apache.camel.springboot</groupId>
+ <artifactId>camel-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -73,10 +63,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
- <artifactId>camel-spring-boot-starter</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-atomix-starter</artifactId>
</dependency>
</dependencies>
diff --git a/camel-example-spring-boot-clustered-route-controller/cluster-node/src/main/java/org/apache/camel/examples/cluster/ClusterNodeConfiguration.java b/camel-example-spring-boot-clustered-route-controller/cluster-node/src/main/java/org/apache/camel/examples/cluster/ClusterNodeConfiguration.java
index edc9b97..30f2549 100644
--- a/camel-example-spring-boot-clustered-route-controller/cluster-node/src/main/java/org/apache/camel/examples/cluster/ClusterNodeConfiguration.java
+++ b/camel-example-spring-boot-clustered-route-controller/cluster-node/src/main/java/org/apache/camel/examples/cluster/ClusterNodeConfiguration.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.examples.cluster;
+import java.util.UUID;
+
import org.apache.camel.builder.RouteBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -23,6 +25,13 @@
@Configuration
public class ClusterNodeConfiguration {
+ private String nodeId = UUID.randomUUID().toString();
+
+ @Bean
+ public String nodeId() {
+ return nodeId;
+ }
+
@Bean
public RouteBuilder routeBuilder() {
return new RouteBuilder() {
@@ -33,13 +42,13 @@
// this node.
from("timer:heartbeat?period=10000")
.routeId("heartbeat")
- .log("HeartBeat route (timer) {{node.id}} ...");
+ .log("HeartBeat route (timer) ${sys.nodeId} ...");
// This route is configured to be clustered so it will be started
// by the controller only when this node is leader
from("timer:clustered?period=5000")
.routeId("clustered")
- .log("Clustered route (timer) {{node.id}} ...");
+ .log("Clustered route (timer) ${sys.nodeId} ...");
}
};
}
diff --git a/camel-example-spring-boot-clustered-route-controller/cluster-node/src/main/resources/application.properties b/camel-example-spring-boot-clustered-route-controller/cluster-node/src/main/resources/application.properties
index 9bdcc4d..a96a140 100644
--- a/camel-example-spring-boot-clustered-route-controller/cluster-node/src/main/resources/application.properties
+++ b/camel-example-spring-boot-clustered-route-controller/cluster-node/src/main/resources/application.properties
@@ -24,24 +24,16 @@
logging.level.org.apache.camel.component.atomix = DEBUG
logging.level.org.apache.camel.examples.cluster = DEBUG
-management.endpoints.enabled-by-default = false
-management.endpoints.jmx.enabled = false
-management.endpoint.health.enabled = true
-
-management.server.port = -1
-
-node.id = ${random.uuid}
-
camel.springboot.name = SampleClusteredRouteController
-camel.springboot.jmx-enabled = false
camel.clustered.controller.enabled = true
camel.clustered.controller.namespace = camel
camel.clustered.controller.initial-delay = 5000
+# local route that is no clustered
camel.clustered.controller.routes.heartbeat.clustered = false
camel.component.atomix.cluster.service.enabled = true
camel.component.atomix.cluster.service.mode = client
camel.component.atomix.cluster.service.nodes = localhost:8700
-camel.component.atomix.cluster.service.id = ${node.id}
+camel.component.atomix.cluster.service.id = ${nodeId}
diff --git a/camel-example-spring-boot-clustered-route-controller/readme.adoc b/camel-example-spring-boot-clustered-route-controller/readme.adoc
index aa3471f..ffcbf70 100644
--- a/camel-example-spring-boot-clustered-route-controller/readme.adoc
+++ b/camel-example-spring-boot-clustered-route-controller/readme.adoc
@@ -13,11 +13,11 @@
3. in a separate shell, run the first camel node
- mvn -pl cluster-node spring-boot:run
+ mvn -pl cluster-node spring-boot:run -DnodeId=foo
4. in a separate shell, run the second camel node
- mvn -pl cluster-node spring-boot:run
+ mvn -pl cluster-node spring-boot:run -DnodeId=bar
=== Help and contributions