Home

Awesome

vertx-eventbus-java

A Vert.x EventBus client written in Java uses Netty, works on Android 2.3.7 +:

Testing

./gradlew test

Building

./gradlew build . The jar file will be in build/libs.

Dependencies

    compile "io.netty:netty-handler:4.1.0.Beta8"
    compile "org.sharegov:mjson:1.3"

Sample projects

Usage

final CountDownLatch countDownLatch = new CountDownLatch(1);
EventBus.connect("127.0.0.1", 7000, new ConnectHandler() {
  @Override
  public void connected(boolean isConnected) {
    if (isConnected) {
      assertTrue(isConnected);
    } else {
      assertFalse(isConnected);
    }
    countDownLatch.countDown();
  }
});
countDownLatch.await();
final CountDownLatch countDownLatch = new CountDownLatch(1);
EventBus.registerHandler("hello", new Handler() {
  @Override
  public void handle(String message) {

    assertEquals("some messgae", Json.read(message).at("body").at("value").asString());
    countDownLatch.countDown();
  }
});

EventBus.publish("hello", Json.object().set("value", "some messgae").toString());
countDownLatch.await();