Skip to content

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

Notifications You must be signed in to change notification settings

kerko/vertx-eventbus-java

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vertx-eventbus-java

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

Building

./gradlew jar . 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 Android Chat app Vertx Event Bus Chat . Sample Vert.x Server bridged to TCP vertx-tcp-bridged-chat-server.

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%