Repository: camel
Updated Branches:
  refs/heads/master 55cfbff4d -> 01ec93d57


Filter route event by id in observer method


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

Branch: refs/heads/master
Commit: 01ec93d5750db589f98d5c5987905bb5ce08fb5c
Parents: 55cfbff
Author: Antonin Stefanutti <anto...@stefanutti.fr>
Authored: Wed Apr 27 17:19:25 2016 +0200
Committer: Antonin Stefanutti <anto...@stefanutti.fr>
Committed: Wed Apr 27 17:19:25 2016 +0200

----------------------------------------------------------------------
 .../camel/example/cdi/xml/Application.java       | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/01ec93d5/examples/camel-example-cdi-xml/src/main/java/org/apache/camel/example/cdi/xml/Application.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-cdi-xml/src/main/java/org/apache/camel/example/cdi/xml/Application.java
 
b/examples/camel-example-cdi-xml/src/main/java/org/apache/camel/example/cdi/xml/Application.java
index b6f7b83..2549f5a 100644
--- 
a/examples/camel-example-cdi-xml/src/main/java/org/apache/camel/example/cdi/xml/Application.java
+++ 
b/examples/camel-example-cdi-xml/src/main/java/org/apache/camel/example/cdi/xml/Application.java
@@ -67,17 +67,14 @@ public class Application {
         return "Matrix » " + body;
     }
 
-    void logout(@Observes RouteStoppedEvent event) {
-        // TODO: being able to filter event by id with @Named
-        if (event.getRoute().getId().equals("terminal")) {
-            System.out.println(
-                  "                                     __ \n"
-                + " _____         _                   _|  |\n"
-                + "|  |  |___ ___| |_ _ ___ ___ ___ _| |  |\n"
-                + "|  |  |   | . | | | | . | . | -_| . |__|\n"
-                + "|_____|_|_|  _|_|___|_  |_  |___|___|__|\n"
-                + "          |_|       |___|___|           ");
-        }
+    void logout(@Observes @Named("terminal") RouteStoppedEvent event) {
+        System.out.println(
+              "                                     __    \n"
+            + " _____         _                   _|  |   \n"
+            + "|  |  |___ ___| |_ _ ___ ___ ___ _| |  |   \n"
+            + "|  |  |   | . | | | | . | . | -_| . |__|   \n"
+            + "|_____|_|_|  _|_|___|_  |_  |___|___|__|   \n"
+            + "          |_|       |___|___|              ");
     }
 
     void shutdown(@Observes @Destroyed(ApplicationScoped.class) Object event) {

Reply via email to