MQTT 5.0 and 3.1.1 compatible and feature-rich MQTT Command Line Interface
A detailed documentation can be found here
At least Java 8 is required to run MqttCLI.
The simplest way to start the MQTT CLI is typing:
Packages for Linux, Mac OS and Windows can be found here: Installation/Packages!
To do a clean build, issue the following command:
$ ./gradlew clean build
This runs the unit tests and compiles a new mqtt-cli-.jar into build/libs.
You can then update an existing MQTT CLI installation by replacing its mqtt-cli-.jar with this one.
build.gradle file contains further instructions for building the platform specific distribution packages.
In a nutshell:
For MacOS/Linux brew:
$ ./gradlew buildBrewFormula
For the Debian package:
$ ./gradlew buildDebianPackage
For the RPM package:
$ ./gradlew buildRpmPackage
For the Windows installer:
$ ./gradlew buildWindowsZip
||Subscribe to a topic on default settings and block the console.|
||Subscribe to the topics test1 and test2 on default settings and block the console.|
||Subscribe to topic test at localhost:1884.|
mqtt sub --help
||Publish the message "Hello" to the test topics with the default settings|
||Publish the message "Hello Tests" on both test topics with the default settings|
||Publish the message "Hello" on localhost:1884|
mqtt pub --help
$ mqtt shell
The Shell-Mode is based around a client context driven use case. Therefore methods like Connect and Disconnect switch the current context of the shell and commands like Publish and Subscribe always relate to the currently active client context.
mqtt shell # starts the shell mqtt> con -i myClient # connect client with identifier myClient> pub -t test -m msg # publish with new context client myClient> dis # disconnect and remove context mqtt> ...
In Shell-Mode the following Commands are available without an active context:
When connected you are switched to the context mode. In context mode all MQTT commands relate to the currently active client.
The following Commands are available with an active context:
The test command runs various tests against the specified broker to find out its features and limitations. By default the test command will use MQTT 3 clients to test the broker first and will afterwards check the connect restrictions returned by a connect of a MQTT 5 client. You can alter this behavior by specifying different options when using the command.
Test the public HiveMQ broker:
$ mqtt test -h broker.hivemq.com MQTT 3: OK - Maximum topic length: 65535 bytes - QoS 0: Received 10/10 publishes in 25,74ms - QoS 1: Received 10/10 publishes in 26,27ms - QoS 2: Received 10/10 publishes in 70,01ms - Retain: OK - Wildcard subscriptions: OK - Shared subscriptions: OK - Payload size: >= 100000 bytes - Maximum client id length: 65535 bytes - Unsupported Ascii Chars: ALL SUPPORTED MQTT 5: OK - Connect restrictions: > Retain: OK > Wildcard subscriptions: OK > Shared subscriptions: OK > Subscription identifiers: OK > Maximum QoS: 2 > Receive maximum: 10 > Maximum packet size: 268435460 bytes > Topic alias maximum: 5 > Session expiry interval: Client-based > Server keep alive: Client-based
The HiveMQ command line argument offers various HiveMQ specific commands.
Show all available commands:
$ mqtt hivemq
The export command of the HiveMQ command line offers a set of commands to export various resources from a HiveMQ API endpoint.
$ mqtt hivemq export
Export client details from a HiveMQ node via the export clients command.
$ mqtt hivemq export clients
Please refer to the detailed documentation MQTT CLI Documentation for more examples and complete command descriptions.
Semantic Versioning is used.