Home

Awesome

javaxbus

Simple Java Vert.x Eventbus TCP-Client (without any dependencies)

A Vert.x EventBus client for java environments, using traditional Socket-IO or NIO. IO and a spare thread to communicate with the vert.x event-bus-tcp-bridge.

Usage


EventBus bus = EventBus.create("localhost", 8089);

bus.consumer("hello", new ConsumerHandler<Json>() {
	@Override
	public void handleMsgFromBus(Message msg) {
		if (!msg.isErrorMsg()) {
    		System.err.println("Received " + msg.getBodyAsMJson().toString());
    	} else {
    		System.err.println("ERROR received " + msg.getErrMessage());
    	}
    	
    }
});
   
// send a message to myself :)
Json jsonPayLoad = Json.object().set("msg", "Hello World");
bus.send("hello", new Message(jsonPayLoad));


Testing

mvn test. Will execute all available tests...... Among the tests are unit tests and some small test-apps. You will need a vert.x instance with a tcp-event-bus-bridge and permissions in/outbound for the 'echo' and the 'echo2' address (do not reg. any consumers on this adr.) in order to run the test-suit.

Building

mvn package. The lib can be found in the target/ folder after maven build and tested the package

Dependencies

as already statet, javaxbus draws heavily on mjson

More examples