Repository: camel
Updated Branches:
  refs/heads/master 430af9a9a -> a6e721b56


CAMEL-11711: Camel-example-spring-cloud-servicecall doesn't work out of the box


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a6e721b5
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a6e721b5
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a6e721b5

Branch: refs/heads/master
Commit: a6e721b566cf98c9ae272bb4c1e7927a94c98481
Parents: 430af9a
Author: lburgazzoli <lburgazz...@gmail.com>
Authored: Wed Sep 20 14:10:10 2017 +0200
Committer: lburgazzoli <lburgazz...@gmail.com>
Committed: Wed Sep 20 14:10:22 2017 +0200

----------------------------------------------------------------------
 .../consumer/pom.xml                            | 12 ------
 .../camel/example/ConsumerApplication.java      |  7 +++-
 .../src/main/resources/application.properties   |  1 +
 .../service/pom.xml                             | 44 +++++++-------------
 .../service/src/main/bash/consul-run-linux.sh   | 28 ++-----------
 .../service/src/main/bash/consul-run-osx.sh     | 27 +-----------
 .../src/main/resources/consul/services.json     | 19 +++++++++
 7 files changed, 48 insertions(+), 90 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a6e721b5/examples/camel-example-spring-cloud-servicecall/consumer/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-cloud-servicecall/consumer/pom.xml 
b/examples/camel-example-spring-cloud-servicecall/consumer/pom.xml
index 8d4a0f6..66fdd23 100644
--- a/examples/camel-example-spring-cloud-servicecall/consumer/pom.xml
+++ b/examples/camel-example-spring-cloud-servicecall/consumer/pom.xml
@@ -120,18 +120,6 @@
       <artifactId>camel-jackson-starter</artifactId>
     </dependency>
 
-    <!-- test -->
-    <dependency>
-      <groupId>org.springframework.boot</groupId>
-      <artifactId>spring-boot-starter-test</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-test-spring</artifactId>
-      <scope>test</scope>
-    </dependency>
-
   </dependencies>
 
   <build>

http://git-wip-us.apache.org/repos/asf/camel/blob/a6e721b5/examples/camel-example-spring-cloud-servicecall/consumer/src/main/java/org/apache/camel/example/ConsumerApplication.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-spring-cloud-servicecall/consumer/src/main/java/org/apache/camel/example/ConsumerApplication.java
 
b/examples/camel-example-spring-cloud-servicecall/consumer/src/main/java/org/apache/camel/example/ConsumerApplication.java
index 62590d8..b7f049b 100644
--- 
a/examples/camel-example-spring-cloud-servicecall/consumer/src/main/java/org/apache/camel/example/ConsumerApplication.java
+++ 
b/examples/camel-example-spring-cloud-servicecall/consumer/src/main/java/org/apache/camel/example/ConsumerApplication.java
@@ -39,12 +39,17 @@ public class ConsumerApplication {
 
             from("direct:service-call")
                 .setBody().constant(null)
+                .removeHeaders("CamelHttp*")
                 .to("log:service-call?level=INFO&showAll=true&multiline=true")
                 .choice()
                     .when(header("serviceId").isEqualTo("service1"))
                         .serviceCall("service-1")
+                        .convertBodyTo(String.class)
+                        .log("service-1 : ${body}")
                     .when(header("serviceId").isEqualTo("service2"))
-                        .serviceCall("service-2");
+                        .serviceCall("service-2")
+                        .convertBodyTo(String.class)
+                        .log("service-1 : ${body}");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/a6e721b5/examples/camel-example-spring-cloud-servicecall/consumer/src/main/resources/application.properties
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-spring-cloud-servicecall/consumer/src/main/resources/application.properties
 
b/examples/camel-example-spring-cloud-servicecall/consumer/src/main/resources/application.properties
index 54fac5a..c633bcc 100644
--- 
a/examples/camel-example-spring-cloud-servicecall/consumer/src/main/resources/application.properties
+++ 
b/examples/camel-example-spring-cloud-servicecall/consumer/src/main/resources/application.properties
@@ -24,6 +24,7 @@ spring.cloud.consul.config.enabled=false
 spring.cloud.consul.discovery.enabled=true
 spring.cloud.consul.discovery.server-list-query-tags[service-1] = camel
 spring.cloud.consul.discovery.server-list-query-tags[service-2] = service-call
+spring.cloud.consul.discovery.register = false
 
 # Camel
 camel.springboot.main-run-controller=true

http://git-wip-us.apache.org/repos/asf/camel/blob/a6e721b5/examples/camel-example-spring-cloud-servicecall/service/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-cloud-servicecall/service/pom.xml 
b/examples/camel-example-spring-cloud-servicecall/service/pom.xml
index 976ee0f..b13b9b9 100644
--- a/examples/camel-example-spring-cloud-servicecall/service/pom.xml
+++ b/examples/camel-example-spring-cloud-servicecall/service/pom.xml
@@ -80,35 +80,23 @@
       <artifactId>camel-undertow-starter</artifactId>
     </dependency>
 
-    <!-- test -->
-    <dependency>
-      <groupId>org.springframework.boot</groupId>
-      <artifactId>spring-boot-starter-test</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-test-spring</artifactId>
-      <scope>test</scope>
-    </dependency>
-
   </dependencies>
 
-    <build>
-      <plugins>
-        <plugin>
-          <groupId>org.springframework.boot</groupId>
-          <artifactId>spring-boot-maven-plugin</artifactId>
-          <version>${spring-boot-version}</version>
-          <executions>
-            <execution>
-              <goals>
-                <goal>repackage</goal>
-              </goals>
-            </execution>
-          </executions>
-        </plugin>
-      </plugins>
-    </build>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>${spring-boot-version}</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>repackage</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
 
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/a6e721b5/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-linux.sh
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-linux.sh
 
b/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-linux.sh
index c170c04..7913219 100755
--- 
a/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-linux.sh
+++ 
b/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-linux.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-CONSUL_VER="0.8.1"
+CONSUL_VER="0.9.3"
 CONSUL_ZIP="consul_${CONSUL_VER}_linux_amd64.zip"
 
 # cleanup
@@ -13,32 +13,12 @@ mkdir -p target/consul-data
 mkdir -p target/consul-config
 
 if [ ! -f target/${CONSUL_ZIP} ]; then
+    echo Downloading: 
https://releases.hashicorp.com/consul/${CONSUL_VER}/${CONSUL_ZIP}
     wget "https://releases.hashicorp.com/consul/${CONSUL_VER}/${CONSUL_ZIP}"; 
-O target/${CONSUL_ZIP}
 fi
 
-cat > target/consul-config/services.json <<EOF
-{
-  "services": [{
-    "id": "s1i1", "name": "service-1", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9011
-  }, {
-    "id": "s1i2", "name": "service-1", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9012
-  }, {
-    "id": "s1i3", "name": "service-1", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9013
-  }, {
-    "id": "s1i4", "name": "service-1", "address": "localhost", "port": 9014
-  }, {
-    "id": "s2i1", "name": "service-2", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9021
-  }, {
-    "id": "s2i2", "name": "service-2", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9022
-  }, {
-    "id": "s2i3", "name": "service-2", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9023
-  }, {
-    "id": "s2i4", "name": "service-2", "address": "localhost", "port": 9024
-  }]
-}
-EOF
-
 unzip -d target target/${CONSUL_ZIP}
+chmod +x target/consul
 
 target/consul \
     agent \
@@ -49,5 +29,5 @@ target/consul \
     -bind 0.0.0.0 \
     -log-level trace \
     -data-dir target/consul-data \
-    -config-dir target/consul-config \
+    -config-dir src/main/resources/consul \
     -ui
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a6e721b5/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-osx.sh
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-osx.sh
 
b/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-osx.sh
index ff314cc..0fc9d57 100755
--- 
a/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-osx.sh
+++ 
b/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-osx.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-CONSUL_VER="0.8.1"
+CONSUL_VER="0.9.3"
 CONSUL_ZIP="consul_${CONSUL_VER}_darwin_amd64.zip"
 
 # cleanup
@@ -12,34 +12,11 @@ mkdir -p target/
 mkdir -p target/consul-data
 mkdir -p target/consul-config
 
-
 if [ ! -f target/$CONSUL_ZIP ]; then
     echo Downloading: 
https://releases.hashicorp.com/consul/$CONSUL_VER/$CONSUL_ZIP 
     curl -o target/$CONSUL_ZIP 
"https://releases.hashicorp.com/consul/$CONSUL_VER/$CONSUL_ZIP";
 fi
 
-cat > target/consul-config/services.json <<EOF
-{
-  "services": [{
-    "id": "s1i1", "name": "service-1", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9011
-  }, {
-    "id": "s1i2", "name": "service-1", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9012
-  }, {
-    "id": "s1i3", "name": "service-1", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9013
-  }, {
-    "id": "s1i4", "name": "service-1", "address": "localhost", "port": 9014
-  }, {
-    "id": "s2i1", "name": "service-2", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9021
-  }, {
-    "id": "s2i2", "name": "service-2", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9022
-  }, {
-    "id": "s2i3", "name": "service-2", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9023
-  }, {
-    "id": "s2i4", "name": "service-2", "address": "localhost", "port": 9024
-  }]
-}
-EOF
-
 unzip -d target target/$CONSUL_ZIP
 chmod +x target/consul
 
@@ -52,5 +29,5 @@ target/consul \
     -bind 0.0.0.0 \
     -log-level trace \
     -data-dir target/consul-data \
-    -config-dir target/consul-config \
+    -config-dir src/main/resources/consul \
     -ui
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a6e721b5/examples/camel-example-spring-cloud-servicecall/service/src/main/resources/consul/services.json
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-spring-cloud-servicecall/service/src/main/resources/consul/services.json
 
b/examples/camel-example-spring-cloud-servicecall/service/src/main/resources/consul/services.json
new file mode 100644
index 0000000..ca43a54
--- /dev/null
+++ 
b/examples/camel-example-spring-cloud-servicecall/service/src/main/resources/consul/services.json
@@ -0,0 +1,19 @@
+{
+  "services": [{
+    "id": "s1i1", "name": "service-1", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9011
+  }, {
+    "id": "s1i2", "name": "service-1", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9012
+  }, {
+    "id": "s1i3", "name": "service-1", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9013
+  }, {
+    "id": "s1i4", "name": "service-1", "address": "localhost", "port": 9014
+  }, {
+    "id": "s2i1", "name": "service-2", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9021
+  }, {
+    "id": "s2i2", "name": "service-2", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9022
+  }, {
+    "id": "s2i3", "name": "service-2", "tags": ["camel", "service-call"], 
"address": "localhost", "port": 9023
+  }, {
+    "id": "s2i4", "name": "service-2", "address": "localhost", "port": 9024
+  }]
+}
\ No newline at end of file

Reply via email to