Skip to content

jvermillard/tipula

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

mqtt-experiment

MQTT asynchronous decoding experiment.

It's an asynchronous MQTT protocol decoder for using with scalable NIO based server or client.

Build with maven : "mvn install" in the codec directory.

For using it is quite simple :

Decoding ByteBuffer of wire protocol to MQTT high level messages :

 
 ByteBuffer buffer = ... // read from the socket, webscoket, or wathever way you want to receive MQTT messages

 AbstractMqttMessage mqttMsg;
 while ((mqttMsg = decoder.decode(((IoBuffer) message).buf(), ctx)) != null) {
    System.out.println("reveiced the MQTT message : "+mqttMsg); 
 }

Encoding MQTT protocol message to Bytebuffer :

 // create a MQTT message using your protocol logic
 // all the MQTT protocol messages (connect, subscribe, publish, ping, etc...) are 
 // available in  the package "mqttexperiment.codec.msg"
 AbstractMqttMessage message = ...

 ByteBuffer buff = encoder.encode(message, null);

 // write the byte buffer to the socket, websocket or wathever way you want for sending MQTT messages

About

MQTT + MINA 3 experiment

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages