Skip to content

A Vert.x EventBus client written in Java, works on Android

Notifications You must be signed in to change notification settings

abdlquadri/vertx-eventbus-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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();

About

A Vert.x EventBus client written in Java, works on Android

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages