Repository: camel Updated Branches: refs/heads/master 6b11a1cbd -> 5b08f5034
CAMEL-11827:[example] spring-boot-servicecall - service1 returns 404 not found Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5b08f503 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5b08f503 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5b08f503 Branch: refs/heads/master Commit: 5b08f5034535a5aa027fee78ff117b7d4a24b483 Parents: 6b11a1c Author: Ramu <kkaka...@redhat.com> Authored: Mon Sep 25 21:25:20 2017 +0530 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Sep 26 08:06:34 2017 +0200 ---------------------------------------------------------------------- .../ServiceCallConsumerAutoConfiguration.java | 9 +++++++-- .../services/src/main/bash/consul-run-linux.sh | 17 ++++------------- .../services/src/main/bash/consul-run-osx.sh | 15 ++------------- .../src/main/resources/consul/services.json | 19 +++++++++++++++++++ 4 files changed, 32 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/5b08f503/examples/camel-example-spring-boot-servicecall/consumer/src/main/java/org/apache/camel/example/ServiceCallConsumerAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-servicecall/consumer/src/main/java/org/apache/camel/example/ServiceCallConsumerAutoConfiguration.java b/examples/camel-example-spring-boot-servicecall/consumer/src/main/java/org/apache/camel/example/ServiceCallConsumerAutoConfiguration.java index dfec5d2..58db270 100644 --- a/examples/camel-example-spring-boot-servicecall/consumer/src/main/java/org/apache/camel/example/ServiceCallConsumerAutoConfiguration.java +++ b/examples/camel-example-spring-boot-servicecall/consumer/src/main/java/org/apache/camel/example/ServiceCallConsumerAutoConfiguration.java @@ -34,13 +34,18 @@ public class ServiceCallConsumerAutoConfiguration { 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-2 : ${body}"); } }; } -} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/5b08f503/examples/camel-example-spring-boot-servicecall/services/src/main/bash/consul-run-linux.sh ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-servicecall/services/src/main/bash/consul-run-linux.sh b/examples/camel-example-spring-boot-servicecall/services/src/main/bash/consul-run-linux.sh index aa5dd3f..a575317 100755 --- a/examples/camel-example-spring-boot-servicecall/services/src/main/bash/consul-run-linux.sh +++ b/examples/camel-example-spring-boot-servicecall/services/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,22 +13,13 @@ 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 - }] -} -EOF unzip -d target target/${CONSUL_ZIP} +chmod +x target/consul target/consul \ agent \ @@ -39,5 +30,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/5b08f503/examples/camel-example-spring-boot-servicecall/services/src/main/bash/consul-run-osx.sh ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-servicecall/services/src/main/bash/consul-run-osx.sh b/examples/camel-example-spring-boot-servicecall/services/src/main/bash/consul-run-osx.sh index b3be9e1..7437de7 100755 --- a/examples/camel-example-spring-boot-servicecall/services/src/main/bash/consul-run-osx.sh +++ b/examples/camel-example-spring-boot-servicecall/services/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 @@ -18,17 +18,6 @@ if [ ! -f target/$CONSUL_ZIP ]; then 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 - }] -} -EOF unzip -d target target/$CONSUL_ZIP chmod +x target/consul @@ -42,5 +31,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/5b08f503/examples/camel-example-spring-boot-servicecall/services/src/main/resources/consul/services.json ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-servicecall/services/src/main/resources/consul/services.json b/examples/camel-example-spring-boot-servicecall/services/src/main/resources/consul/services.json new file mode 100644 index 0000000..ca43a54 --- /dev/null +++ b/examples/camel-example-spring-boot-servicecall/services/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