bundle provides the Java client. It provides publish and subscribe capabilities to both topic and queue destinations. It also allows user properties to be added to messages as well as support for formatted payloads.
Example usage of the Java API
The following code snippet, using the API, shows how to connect to the broker, publish one message and then disconnect. Note that the code excerpt does not show all the Java™ exception handling that may be required.
MqttClient client = new MqttClient("tcp://localhost:1883");
client.getTopic("foo/bar").publish(new MqttMessage("Hello world"));
Parent topic: Developing an application using the MQTT proprietary API