Skip to content
Browse files

Using .log instead of a Processor for output

  • Loading branch information...
1 parent 4923546 commit 1b2aaa97869a7e95fa82e716781847055c5adf3e @whaley committed Sep 25, 2011
Showing with 8 additions and 11 deletions.
  1. +8 −11 message-groups/src/main/java/com/brinksys/camel/App.java
View
19 message-groups/src/main/java/com/brinksys/camel/App.java
@@ -42,17 +42,9 @@ public void configure() throws Exception {
.end()
.to("amq:queue:Message.Group.Test");
- from("amq:queue:Message.Group.Test").routeId("Route A").process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- System.out.println("Route A Recieved :: " + exchange.getIn().getBody());
- }
- });
-
- from("amq:queue:Message.Group.Test").routeId("Route B").process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- System.out.println("Route B Recieved :: " + exchange.getIn().getBody());
- }
- });
+ /* These two are competing consumers */
+ from("amq:queue:Message.Group.Test").routeId("Route A").log("Received: ${body}");
+ from("amq:queue:Message.Group.Test").routeId("Route B").log("Received: ${body}");
}
});
@@ -84,9 +76,14 @@ private static void sendMessages(ProducerTemplate pt) throws Exception {
for (int i = 0; i < 10; i++) {
pt.sendBody("direct:begin", Integer.valueOf(i));
}
+
for (int i = 0; i < 10; i++) {
pt.sendBody("direct:begin", "next group");
}
+
+ pt.sendBody("direct:begin", Integer.valueOf(1));
+ pt.sendBody("direct:begin", "foo");
+ pt.sendBody("direct:begin", Integer.valueOf(2));
}
private static void startBroker() throws Exception {

0 comments on commit 1b2aaa9

Please sign in to comment.
Something went wrong with that request. Please try again.