MQTT Java client library
Eclipse Paho Java Client provides asynchronous and synchronous API of MqttAsyncClient and MqttClient .
In the Java system, Paho Java is a relatively stable and widely used MQTT client library. This example contains the complete code of Paho Java in the Java language connecting to EMQX Broker, sending and receiving messages:
Callback message processing class OnMessageCallback.java