Repository: camel
Updated Branches:
  refs/heads/master 14a7dd791 -> da9f0f773


[CAMEL-8987] Vert.x endpoints supports mutliple consumers.


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

Branch: refs/heads/master
Commit: da9f0f773f37a09c61c276e0e4b6ac19ab4ba09b
Parents: 14a7dd7
Author: Henryk Konsek <hekon...@gmail.com>
Authored: Mon Jul 20 17:08:39 2015 +0200
Committer: Henryk Konsek <hekon...@gmail.com>
Committed: Mon Jul 20 17:08:39 2015 +0200

----------------------------------------------------------------------
 .../camel/component/vertx/VertxEndpoint.java    |  8 +++-
 .../vertx/VertxMultipleConsumerTest.java        | 48 ++++++++++++++++++++
 2 files changed, 55 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/da9f0f77/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxEndpoint.java
 
b/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxEndpoint.java
index e1fef5c..2831282 100644
--- 
a/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxEndpoint.java
+++ 
b/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxEndpoint.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.vertx;
 import io.vertx.core.Vertx;
 import io.vertx.core.eventbus.EventBus;
 import org.apache.camel.Consumer;
+import org.apache.camel.MultipleConsumersSupport;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
@@ -31,7 +32,7 @@ import org.apache.camel.spi.UriPath;
  * A Camel Endpoint for working with <a href="http://vertx.io/";>vert.x</a> 
event bus endpoints
  */
 @UriEndpoint(scheme = "vertx", title = "Vert.x", syntax = "vertx:address", 
consumerClass = VertxConsumer.class, label = "eventbus")
-public class VertxEndpoint extends DefaultEndpoint {
+public class VertxEndpoint extends DefaultEndpoint implements 
MultipleConsumersSupport {
 
     @UriPath @Metadata(required = "true")
     private String address;
@@ -62,6 +63,11 @@ public class VertxEndpoint extends DefaultEndpoint {
         return true;
     }
 
+    @Override
+    public boolean isMultipleConsumersSupported() {
+        return true;
+    }
+
     public EventBus getEventBus() {
         if (getVertx() != null) {
             return getVertx().eventBus();

http://git-wip-us.apache.org/repos/asf/camel/blob/da9f0f77/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxMultipleConsumerTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxMultipleConsumerTest.java
 
b/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxMultipleConsumerTest.java
new file mode 100644
index 0000000..d20299d
--- /dev/null
+++ 
b/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxMultipleConsumerTest.java
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.vertx;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+public class VertxMultipleConsumerTest extends VertxBaseTestSupport {
+
+    protected String startUri = "vertx:foo.start?pubSub=true";
+    protected String resultUri = "mock:result";
+
+    protected MockEndpoint resultEndpoint;
+
+    @Test
+    public void shouldSendMessageToMultpleConsumers() throws Exception {
+        resultEndpoint = context.getEndpoint(resultUri, MockEndpoint.class);
+        resultEndpoint.expectedMessageCount(2);
+
+        template.sendBody(startUri, "msg");
+
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from(startUri).to(resultUri);
+                from(startUri).to(resultUri);
+            }
+        };
+    }
+}
\ No newline at end of file

Reply via email to