MQTTV3Sample program

Reference information about sample syntax and parameters for the MQTTV3Sample program.

Purpose

The MQTTV3Sample program can be used to publish a message and subscribe to a topic.

MQTTV3Sample syntax

Read syntax diagramSkip visual syntax diagram MQTTV3Sample -h -qfalse-qtrue-apublish-asubscribe-tSYSTEM.BASE.TOPIC-ttopic-mdefault text-mmessage text-s2-s0-s1-blocalhost-bhost name-bIP address-p1883-pport

Parameters

-h
Print this help text and quit
-q
Set quiet mode, instead of using the default mode of false.
-a
Set publish or subscribe, instead of assuming the default action of publishing.
-t
Publish or subscribe to topic, instead of publishing or subscribing to the default topic
-m
Publish message text instead of sending the default publication text, "Hello from an MQTT v3 application".
-s
Set QoS instead of using the default QoS, 2.
-b
Connect to this host name or IP address instead of connecting to the default host name, localhost.
-p
Use this port instead of using the default, 1883.

Run the MQTTV3Sample program

To subscribe to a topic on Windows, use the command:

runMQTTV3Sample -a subscribe
To publish a message on Windows, use the command:

runMQTTV3Sample

For further information about running the sample scripts provided, see IBM MQ Telemetry Transport sample programs.