You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2014/08/07 16:48:23 UTC

[2/8] git commit: Polished example

Polished example


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

Branch: refs/heads/master
Commit: 112dff88fcf54bce7d52e61a8758a856c9b37a7d
Parents: 67ba6ff
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Aug 7 11:17:29 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Aug 7 11:17:29 2014 +0200

----------------------------------------------------------------------
 .../example/pojo_messaging/DistributeRecordsBean.java    |  9 ++++++++-
 .../pojo_messaging/SendFileRecordsToQueueBean.java       | 11 +++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/112dff88/examples/camel-example-pojo-messaging/src/main/java/org/apache/camel/example/pojo_messaging/DistributeRecordsBean.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-pojo-messaging/src/main/java/org/apache/camel/example/pojo_messaging/DistributeRecordsBean.java b/examples/camel-example-pojo-messaging/src/main/java/org/apache/camel/example/pojo_messaging/DistributeRecordsBean.java
index b1c2df7..d8071e2 100644
--- a/examples/camel-example-pojo-messaging/src/main/java/org/apache/camel/example/pojo_messaging/DistributeRecordsBean.java
+++ b/examples/camel-example-pojo-messaging/src/main/java/org/apache/camel/example/pojo_messaging/DistributeRecordsBean.java
@@ -19,17 +19,24 @@ package org.apache.camel.example.pojo_messaging;
 import org.apache.camel.Consume;
 import org.apache.camel.RecipientList;
 import org.apache.camel.language.XPath;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 //START SNIPPET: ex
 public class DistributeRecordsBean {
+
+    private static final Logger LOG = LoggerFactory.getLogger(DistributeRecordsBean.class);
+
     @Consume(uri = "activemq:personnel.records")
     @RecipientList
     public String[] route(@XPath("/person/city/text()") String city) {
         if (city.equals("London")) {
+            LOG.info("Person is from EMEA region");
             return new String[] {"file:target/messages/emea/hr_pickup", 
                                  "file:target/messages/emea/finance_pickup"};
         } else {
-            return new String[] {"file:target/messages/amer/hr_pickup", 
+            LOG.info("Person is from AMER region");
+            return new String[] {"file:target/messages/amer/hr_pickup",
                                  "file:target/messages/amer/finance_pickup"};
         }
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/112dff88/examples/camel-example-pojo-messaging/src/main/java/org/apache/camel/example/pojo_messaging/SendFileRecordsToQueueBean.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-pojo-messaging/src/main/java/org/apache/camel/example/pojo_messaging/SendFileRecordsToQueueBean.java b/examples/camel-example-pojo-messaging/src/main/java/org/apache/camel/example/pojo_messaging/SendFileRecordsToQueueBean.java
index 176893a..7eb935c 100644
--- a/examples/camel-example-pojo-messaging/src/main/java/org/apache/camel/example/pojo_messaging/SendFileRecordsToQueueBean.java
+++ b/examples/camel-example-pojo-messaging/src/main/java/org/apache/camel/example/pojo_messaging/SendFileRecordsToQueueBean.java
@@ -17,16 +17,23 @@
 package org.apache.camel.example.pojo_messaging;
 
 import org.apache.camel.Consume;
+import org.apache.camel.Header;
 import org.apache.camel.Produce;
 import org.apache.camel.ProducerTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 //START SNIPPET: ex
 public class SendFileRecordsToQueueBean {
+
+    private static final Logger LOG = LoggerFactory.getLogger(SendFileRecordsToQueueBean.class);
+
     @Produce(uri = "activemq:personnel.records")
     ProducerTemplate producer;
 
-    @Consume(uri = "file:src/data?noop=true&initialDelay=100&delay=100")
-    public void onFileSendToQueue(String body) {
+    @Consume(uri = "file:src/data?noop=true")
+    public void onFileSendToQueue(String body, @Header("CamelFileName") String name) {
+        LOG.info("Incoming file: {}", name);
         producer.sendBody(body);
     }
 }