CAMEL-11563: Add predicate option to @Consume so the bean is only called if its evaluated to true
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/261ce8d2 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/261ce8d2 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/261ce8d2 Branch: refs/heads/master Commit: 261ce8d29d410ca444ac3613720dc43f41312a7c Parents: 9041c4d Author: Claus Ibsen <davscl...@apache.org> Authored: Sun Jul 23 16:10:20 2017 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sun Jul 23 16:10:20 2017 +0200 ---------------------------------------------------------------------- .../src/main/java/sample/camel/NumberPojo.java | 4 ++-- .../src/main/java/sample/camel/NumberRoute.java | 2 +- .../src/main/resources/application.properties | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/261ce8d2/examples/camel-example-spring-boot-pojo/src/main/java/sample/camel/NumberPojo.java ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-pojo/src/main/java/sample/camel/NumberPojo.java b/examples/camel-example-spring-boot-pojo/src/main/java/sample/camel/NumberPojo.java index 1a08dcb..081e09e 100644 --- a/examples/camel-example-spring-boot-pojo/src/main/java/sample/camel/NumberPojo.java +++ b/examples/camel-example-spring-boot-pojo/src/main/java/sample/camel/NumberPojo.java @@ -35,13 +35,13 @@ public class NumberPojo { private MagicNumber magic; // only consume when the predicate matches, eg when the message body is lower than 100 - @Consume(uri = "seda:numbers", predicate = "${body} < 100") + @Consume(uri = "direct:numbers", predicate = "${body} < 100") public void lowNumber(int number) { magic.onMagicNumber("Got a low number " + number); } // only consume when the predicate matches, eg when the message body is higher or equal to 100 - @Consume(uri = "seda:numbers", predicate = "${body} >= 100") + @Consume(uri = "direct:numbers", predicate = "${body} >= 100") public void highNumber(int number) { magic.onMagicNumber("Got a high number " + number); } http://git-wip-us.apache.org/repos/asf/camel/blob/261ce8d2/examples/camel-example-spring-boot-pojo/src/main/java/sample/camel/NumberRoute.java ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-pojo/src/main/java/sample/camel/NumberRoute.java b/examples/camel-example-spring-boot-pojo/src/main/java/sample/camel/NumberRoute.java index 0014d65..cfae835 100644 --- a/examples/camel-example-spring-boot-pojo/src/main/java/sample/camel/NumberRoute.java +++ b/examples/camel-example-spring-boot-pojo/src/main/java/sample/camel/NumberRoute.java @@ -28,7 +28,7 @@ public class NumberRoute extends RouteBuilder { // which is send to this seda queue that the NumberPojo will consume from("timer:number?period=1s") .transform().simple("${random(0,200)}") - .to("seda:numbers"); + .to("direct:numbers"); } } http://git-wip-us.apache.org/repos/asf/camel/blob/261ce8d2/examples/camel-example-spring-boot-pojo/src/main/resources/application.properties ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-pojo/src/main/resources/application.properties b/examples/camel-example-spring-boot-pojo/src/main/resources/application.properties index e19b0e3..ac3b8d5 100644 --- a/examples/camel-example-spring-boot-pojo/src/main/resources/application.properties +++ b/examples/camel-example-spring-boot-pojo/src/main/resources/application.properties @@ -21,5 +21,5 @@ camel.springboot.name = PojoExample # keep camel running camel.springboot.main-run-controller = true -# automatic shutdown after 60 messages -camel.springboot.duration-max-messages = 60 +# automatic shutdown after 60 seconds +camel.springboot.duration-max-seconds = 60