Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abdlquadri/vertx-eventbus-java
A Vert.x EventBus client written in Java, works on Android
https://github.com/abdlquadri/vertx-eventbus-java
android eventbus java vertx
Last synced: 3 months ago
JSON representation
A Vert.x EventBus client written in Java, works on Android
- Host: GitHub
- URL: https://github.com/abdlquadri/vertx-eventbus-java
- Owner: abdlquadri
- Created: 2015-12-22T22:23:55.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-29T09:04:00.000Z (about 7 years ago)
- Last Synced: 2024-04-11T11:34:57.739Z (7 months ago)
- Topics: android, eventbus, java, vertx
- Language: Java
- Homepage:
- Size: 79.1 KB
- Stars: 20
- Watchers: 7
- Forks: 10
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- vertx-awesome - Java - Java and Android Event Bus Client. (Vert.x Event Bus Clients)
README
# vertx-eventbus-java
A [Vert.x EventBus](http://vertx.io/docs/vertx-core/java/#event_bus) client written in Java uses [Netty](http://netty.io/), works on Android 2.3.7 +:
# Testing
`./gradlew test`# Building
`./gradlew build` . The jar file will be in build/libs.
# Dependencies
```java
compile "io.netty:netty-handler:4.1.0.Beta8"
compile "org.sharegov:mjson:1.3"
```# Sample projects
* Sample Android Chat app [Vertx Event Bus Chat](https://github.com/abdlquadri/VertxEventBusChat).
* Sample Vert.x Server bridged to TCP [vertx-tcp-bridged-chat-server](https://github.com/abdlquadri/vertx-tcp-bridged-chat-server).# Usage
```java
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();
``````java
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();
```