camel git commit: Upgrade Kubernetes/Openshift client to version 1.3.99
Repository: camel Updated Branches: refs/heads/master 167e97e57 -> 580eae678 Upgrade Kubernetes/Openshift client to version 1.3.99 Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/580eae67 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/580eae67 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/580eae67 Branch: refs/heads/master Commit: 580eae678ce118c1e38918026e94b39763ca7473 Parents: 167e97e Author: Andrea CosentinoAuthored: Tue Jul 12 17:09:31 2016 +0200 Committer: Andrea Cosentino Committed: Tue Jul 12 17:09:31 2016 +0200 -- parent/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/580eae67/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index 59717dc..cf2ef87 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -362,7 +362,7 @@ 4.0.5 6.4.0.Final 0.4.9 -1.3.98 +1.3.99 1.0.52 2.3.0_3 1.8 @@ -442,7 +442,7 @@ 4.7.4 2.4.1 2.7.0.Final -1.3.98 +1.3.99 6.4.0.Final 2.0.8_6 2.4_5
camel git commit: CAMEL-10137: Add a Camel-Kubernetes example - Fix docs title
Repository: camel Updated Branches: refs/heads/master 574cb0c67 -> 167e97e57 CAMEL-10137: Add a Camel-Kubernetes example - Fix docs title Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/167e97e5 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/167e97e5 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/167e97e5 Branch: refs/heads/master Commit: 167e97e575d239a879e0b9eb469623476d4c580d Parents: 574cb0c Author: Andrea CosentinoAuthored: Tue Jul 12 11:23:21 2016 +0200 Committer: Andrea Cosentino Committed: Tue Jul 12 11:23:21 2016 +0200 -- examples/camel-example-cdi-kubernetes/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/167e97e5/examples/camel-example-cdi-kubernetes/README.md -- diff --git a/examples/camel-example-cdi-kubernetes/README.md b/examples/camel-example-cdi-kubernetes/README.md index 74dfe7d..ebad46d 100644 --- a/examples/camel-example-cdi-kubernetes/README.md +++ b/examples/camel-example-cdi-kubernetes/README.md @@ -1,4 +1,4 @@ -# Metrics Example - CDI +# Kubernetes Example - CDI ### Introduction
[1/3] camel git commit: CAMEL-10137: Add a Camel-Kubernetes example - first spike
Repository: camel Updated Branches: refs/heads/master f41e20eaf -> 574cb0c67 CAMEL-10137: Add a Camel-Kubernetes example - first spike Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/cf37670f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/cf37670f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/cf37670f Branch: refs/heads/master Commit: cf37670fe32194cc218c8d1116214daa4528c9bf Parents: f41e20e Author: Andrea CosentinoAuthored: Tue Jul 12 10:39:22 2016 +0200 Committer: Andrea Cosentino Committed: Tue Jul 12 10:39:22 2016 +0200 -- examples/camel-example-cdi-kubernetes/README.md | 76 +++ examples/camel-example-cdi-kubernetes/pom.xml | 118 +++ .../example/cdi/kubernetes/Application.java | 84 .../src/main/resources/META-INF/LICENSE.txt | 203 +++ .../src/main/resources/META-INF/NOTICE.txt | 11 + .../META-INF/apache-deltaspike.properties | 18 ++ .../src/main/resources/META-INF/beans.xml | 18 ++ .../src/main/resources/log4j.properties | 27 +++ examples/pom.xml| 1 + 9 files changed, 556 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/cf37670f/examples/camel-example-cdi-kubernetes/README.md -- diff --git a/examples/camel-example-cdi-kubernetes/README.md b/examples/camel-example-cdi-kubernetes/README.md new file mode 100644 index 000..59dcf14 --- /dev/null +++ b/examples/camel-example-cdi-kubernetes/README.md @@ -0,0 +1,76 @@ +# Metrics Example - CDI + +### Introduction + +This example illustrates the integration between Camel, Dropwizard Metrics and CDI. + +The example emulates an unreliable service that processes a continuous stream of events. +The unreliable service fails randomly and metrics get collected to report +the number of generated events as well as the total number of attempted, redelivered, +failed and successful calls to the service. A SLF4J reporter is configured so that +these metrics details get logged every 10 seconds in the console. + +The example is implemented in Java with CDI dependency injection. It uses JBoss Weld +as the minimal CDI container to run the application, though you can run the application +in any CDI compliant container. + +The `camel-cdi`, `camel-core` and `camel-metrics` components are used in this example. +The `camel-test-cdi` module is used for the JUnit test runner. +Besides, the Metrics CDI extension is used so that metrics can be injected +and custom metrics registered via CDI. For instance, a ratio gauge is registered +to monitor the success rate, that is the ratio of success calls on the number +of generated events. + +### Build + +You will need to build this example first: + +```sh +$ mvn install +``` + +### Run + +You can run this example using: + +```sh +$ mvn compile camel:run +``` + +When the Camel application runs, you should see the calls to the 'unreliable-service' being logged to the console, e.g.: +``` +2016-01-18 15:19:04,390 [ timer://stream] INFO unreliable-service - Processing event #8... +2016-01-18 15:19:06,399 [ timer://stream] ERROR unreliable-service - Failed processing event #8 +2016-01-18 15:19:06,400 [ timer://stream] INFO unreliable-service - Processing event #9... +2016-01-18 15:19:08,410 [ timer://stream] ERROR unreliable-service - Failed processing event #9 +2016-01-18 15:19:08,411 [ timer://stream] INFO unreliable-service - Processing event #10... +2016-01-18 15:19:08,412 [ timer://stream] INFO unreliable-service - Successfully processed event #10 +2016-01-18 15:19:09,415 [ timer://stream] INFO unreliable-service - Processing event #11... +2016-01-18 15:19:09,416 [ timer://stream] INFO unreliable-service - Successfully processed event #11 +2016-01-18 15:19:10,420 [ timer://stream] INFO unreliable-service - Processing event #12... +2016-01-18 15:19:10,421 [ timer://stream] INFO unreliable-service - Successfully processed event #12 +2016-01-18 15:19:11,424 [ timer://stream] INFO unreliable-service - Processing event #13... +2016-01-18 15:19:12,428 [ timer://stream] WARN unreliable-service - Processed event #13 after 1 retries +2016-01-18 15:19:12,430 [ timer://stream] INFO unreliable-service - Successfully processed event #13 +``` + +And every 10 seconds, the metrics report, e.g.: +``` +2016-01-18 15:19:14,360 [rter-1-thread-1] INFO metrics - type=GAUGE, name=success-ratio, value=0.9314661799835947 +2016-01-18 15:19:14,361 [rter-1-thread-1] INFO metrics - type=METER, name=attempt, count=26, mean_rate=1.3682531895692165, m1=1.245416192969619, m5=1.209807850571521, m15=1.2033118138834105, rate_unit=events/second +2016-01-18
[3/3] camel git commit: Fixed CS
Fixed CS Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/574cb0c6 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/574cb0c6 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/574cb0c6 Branch: refs/heads/master Commit: 574cb0c67d8d76f333acb3f892aebdd98e32cd49 Parents: 0c241dc Author: Andrea CosentinoAuthored: Tue Jul 12 11:08:27 2016 +0200 Committer: Andrea Cosentino Committed: Tue Jul 12 11:08:27 2016 +0200 -- .../example/cdi/kubernetes/Application.java | 27 ++-- 1 file changed, 13 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/574cb0c6/examples/camel-example-cdi-kubernetes/src/main/java/org/apache/camel/example/cdi/kubernetes/Application.java -- diff --git a/examples/camel-example-cdi-kubernetes/src/main/java/org/apache/camel/example/cdi/kubernetes/Application.java b/examples/camel-example-cdi-kubernetes/src/main/java/org/apache/camel/example/cdi/kubernetes/Application.java index 16cd57a..db25c64 100644 --- a/examples/camel-example-cdi-kubernetes/src/main/java/org/apache/camel/example/cdi/kubernetes/Application.java +++ b/examples/camel-example-cdi-kubernetes/src/main/java/org/apache/camel/example/cdi/kubernetes/Application.java @@ -24,6 +24,8 @@ import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Produces; import javax.inject.Named; +import io.fabric8.kubernetes.api.model.Pod; + import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.builder.RouteBuilder; @@ -33,8 +35,6 @@ import org.apache.camel.component.properties.PropertiesComponent; import org.apache.camel.component.properties.PropertiesParser; import org.apache.deltaspike.core.api.config.ConfigResolver; -import io.fabric8.kubernetes.api.model.Pod; - class Application { @ContextName("camel-example-kubernetes-cdi") @@ -46,19 +46,18 @@ class Application { from("timer:stream?repeatCount=3") .to("kubernetes://{{kubernetes-master-url}}?oauthToken={{kubernetes-oauth-token}}=pods=listPods") .process(new Processor() { - - @Override - public void process(Exchange exchange) throws Exception { - List list = exchange.getIn().getBody(List.class); - System.out.println("We currently have " + list.size() + " pods"); - Iterator it = list.iterator(); + +@Override +public void process(Exchange exchange) throws Exception { +List list = exchange.getIn().getBody(List.class); +System.out.println("We currently have " + list.size() + " pods"); +Iterator it = list.iterator(); while (it.hasNext()) { - Pod pod = it.next(); - System.out.println("Pod name " + pod.getMetadata().getName() + " with status " + pod.getStatus().getPhase()); - } - - } - }); +Pod pod = it.next(); +System.out.println("Pod name " + pod.getMetadata().getName() + " with status " + pod.getStatus().getPhase()); +} +} +}); } }
[2/3] camel git commit: CAMEL-10137: Add a Camel-Kubernetes example - Add docs and little fixes
CAMEL-10137: Add a Camel-Kubernetes example - Add docs and little fixes Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0c241dc3 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0c241dc3 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0c241dc3 Branch: refs/heads/master Commit: 0c241dc374b4f9ce0a06f9e19e22f31855674253 Parents: cf37670 Author: Andrea CosentinoAuthored: Tue Jul 12 10:50:00 2016 +0200 Committer: Andrea Cosentino Committed: Tue Jul 12 10:50:00 2016 +0200 -- examples/camel-example-cdi-kubernetes/README.md | 61 +++- examples/camel-example-cdi-kubernetes/pom.xml | 13 - .../example/cdi/kubernetes/Application.java | 2 +- 3 files changed, 23 insertions(+), 53 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/0c241dc3/examples/camel-example-cdi-kubernetes/README.md -- diff --git a/examples/camel-example-cdi-kubernetes/README.md b/examples/camel-example-cdi-kubernetes/README.md index 59dcf14..74dfe7d 100644 --- a/examples/camel-example-cdi-kubernetes/README.md +++ b/examples/camel-example-cdi-kubernetes/README.md @@ -2,24 +2,14 @@ ### Introduction -This example illustrates the integration between Camel, Dropwizard Metrics and CDI. +This example illustrates the integration between Camel, CDI and Kubernetes. -The example emulates an unreliable service that processes a continuous stream of events. -The unreliable service fails randomly and metrics get collected to report -the number of generated events as well as the total number of attempted, redelivered, -failed and successful calls to the service. A SLF4J reporter is configured so that -these metrics details get logged every 10 seconds in the console. +The example get the list of pods from a Kubernetes cluster and print name and status of each one of the pods returned. -The example is implemented in Java with CDI dependency injection. It uses JBoss Weld -as the minimal CDI container to run the application, though you can run the application -in any CDI compliant container. - -The `camel-cdi`, `camel-core` and `camel-metrics` components are used in this example. -The `camel-test-cdi` module is used for the JUnit test runner. -Besides, the Metrics CDI extension is used so that metrics can be injected -and custom metrics registered via CDI. For instance, a ratio gauge is registered -to monitor the success rate, that is the ratio of success calls on the number -of generated events. +The `camel-cdi`, `camel-core` and `camel-kubernetes` components are used in this example. +The example assumes you have a running Kubernetes cluster in your environment. +For example you can use [minikube](https://github.com/kubernetes/minikube) or the [vagrant openshift image](https://github.com/fabric8io/fabric8-installer/tree/master/vagrant/openshift) from [Fabric8 Team](http://fabric8.io/). +Remember to edit the apache-deltaspike.properties file to use the correct Kubernetes Master URL and OAuth token for your environment. ### Build @@ -37,32 +27,25 @@ You can run this example using: $ mvn compile camel:run ``` -When the Camel application runs, you should see the calls to the 'unreliable-service' being logged to the console, e.g.: +When the Camel application runs, you should see the Pods name and status. For example: ``` -2016-01-18 15:19:04,390 [ timer://stream] INFO unreliable-service - Processing event #8... -2016-01-18 15:19:06,399 [ timer://stream] ERROR unreliable-service - Failed processing event #8 -2016-01-18 15:19:06,400 [ timer://stream] INFO unreliable-service - Processing event #9... -2016-01-18 15:19:08,410 [ timer://stream] ERROR unreliable-service - Failed processing event #9 -2016-01-18 15:19:08,411 [ timer://stream] INFO unreliable-service - Processing event #10... -2016-01-18 15:19:08,412 [ timer://stream] INFO unreliable-service - Successfully processed event #10 -2016-01-18 15:19:09,415 [ timer://stream] INFO unreliable-service - Processing event #11... -2016-01-18 15:19:09,416 [ timer://stream] INFO unreliable-service - Successfully processed event #11 -2016-01-18 15:19:10,420 [ timer://stream] INFO unreliable-service - Processing event #12... -2016-01-18 15:19:10,421 [ timer://stream] INFO unreliable-service - Successfully processed event #12 -2016-01-18 15:19:11,424 [ timer://stream] INFO unreliable-service - Processing event #13... -2016-01-18 15:19:12,428 [ timer://stream] WARN unreliable-service - Processed event #13 after 1 retries -2016-01-18 15:19:12,430 [ timer://stream] INFO unreliable-service - Successfully processed event #13 +We currently have 13 pods +Pod name docker-registry-1-c6ie5 with status