How to see published messages
Comments
-
Hi Praveen!
You can indeed check whether your published messages are actually being processed by your broker or not using multiple ways:
- PubSub+ Cloud UI: If you are using a broker that is hosted on the cloud, you can navigate to the messaging service cloud management console and click on the "Try Me!" tab
and from there, you can connect to your broker using the subscriber application
Once you do that, you can subscribe to any topic you want, so that when your publishing application sends messages to the broker on that topic you can see it. Tip you can leverage Solace Wildcards so you can just subscribe to
devices/>
which will let the subscribing application receive all messages sent on devices/.../..../...- PubSub+ Management UI: if you are connecting to a local software version of the broker (e.g. using a docker), you can access the broker management console and navigate to the "Try Me!" tab
and do the same thing in step 1- You can build your own subscribing application using python and mqtt! Run the following python subscriber program in a separate terminal while your publishing application is running:
import paho.mqtt.client as mqtt import json def on_connect(client, data, flags, rc): assert (rc == 0), "Error Connecting. Return code: " + str(rc) client.subscribe("device/#") #NOTE: The MQTT wildcard '#' is the same as the Solace '>' wildcard def on_message(client, data, msg): msg_json_object = json.loads(msg.payload.decode('ascii')) msg_json_pretty = json.dumps(msg_json_object, indent=2) print("Received message on: %s\n %s" % (msg.topic, msg_json_pretty)) # Broker Info url = <host url> username = password = client = mqtt.Client() client.username_pw_set(username=username, password=password) client.on_connect = on_connect client.on_message = on_message client.connect(url) client.loop_forever()
Let me know if you want more input on this, hope this helps. @pr320235
2 -
also, you are publishing with QoS1 which is a guaranteed message in PubSub+. If the publisher got an acknowledgment from the broker, it was successful.
0 -
The user and all related content has been deleted.1