Updated reactive vertx example
diff --git a/examples/camel-example-reactive-executor-vertx/pom.xml b/examples/camel-example-reactive-executor-vertx/pom.xml
index b94de2f..9ff9355 100644
--- a/examples/camel-example-reactive-executor-vertx/pom.xml
+++ b/examples/camel-example-reactive-executor-vertx/pom.xml
@@ -63,6 +63,10 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-reactive-executor-vertx</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-threadpoolfactory-vertx</artifactId>
+ </dependency>
<!-- logging -->
<dependency>
diff --git a/examples/camel-example-reactive-executor-vertx/readme.adoc b/examples/camel-example-reactive-executor-vertx/readme.adoc
index 03d30e7..f5ebcbf 100644
--- a/examples/camel-example-reactive-executor-vertx/readme.adoc
+++ b/examples/camel-example-reactive-executor-vertx/readme.adoc
@@ -8,7 +8,7 @@
You can run this example using
- mvn camel:run
+ mvn camel:run
=== More information
diff --git a/examples/camel-example-reactive-executor-vertx/src/main/java/org/apache/camel/example/MyApplication.java b/examples/camel-example-reactive-executor-vertx/src/main/java/org/apache/camel/example/MyApplication.java
index 496b37d..1c4d27c 100644
--- a/examples/camel-example-reactive-executor-vertx/src/main/java/org/apache/camel/example/MyApplication.java
+++ b/examples/camel-example-reactive-executor-vertx/src/main/java/org/apache/camel/example/MyApplication.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.example;
+import io.vertx.core.Vertx;
import org.apache.camel.main.Main;
/**
@@ -23,16 +24,25 @@
*/
public final class MyApplication {
+ private static Vertx vertx;
+
private MyApplication() {
}
public static void main(String[] args) throws Exception {
+ vertx = Vertx.vertx();
+
// use Camels Main class
Main main = new Main();
+ // register existing vertx which should be used by Camel
+ main.bind("vertx", vertx);
// and add the routes (you can specify multiple classes)
main.configure().addRoutesBuilder(MyRouteBuilder.class);
// now keep the application running until the JVM is terminated (ctrl + c or sigterm)
main.run(args);
+
+ // stop vertx
+ vertx.close();
}
}
diff --git a/examples/camel-example-reactive-executor-vertx/src/main/java/org/apache/camel/example/MyRouteBuilder.java b/examples/camel-example-reactive-executor-vertx/src/main/java/org/apache/camel/example/MyRouteBuilder.java
index 37cbe20..91acfeb 100644
--- a/examples/camel-example-reactive-executor-vertx/src/main/java/org/apache/camel/example/MyRouteBuilder.java
+++ b/examples/camel-example-reactive-executor-vertx/src/main/java/org/apache/camel/example/MyRouteBuilder.java
@@ -22,9 +22,10 @@
@Override
public void configure() throws Exception {
- from("timer:foo?period=2000")
- .setBody().constant("Hello World")
- .delay(simple("${random(0,1000)}"))
- .log("${body}");
+ from("timer:foo?period=5s")
+ .setBody().constant("H,e,l,l,o, ,W,o,r,l,d,!,!,!, , ")
+ .split(body().tokenize(",")).parallelProcessing()
+ .log("${body}")
+ .end();
}
}