I have created a sample Publish and subscribe model project using the WSO2 Message Broker.
import threading
import paho.mqtt.client as mqtt
def publish_1(client,topic):
message="on"
print("publish data")
client.publish(topic,message)
publish_1(client,topic)
broker="localhost"
topic_pub='/temperature123'
topic_sub='$SYS/#'
def on_connect(client, userdata, rc):
print("Connected with result code "+str(rc))
client.subscribe(topic_sub)
def on_message(client, userdata, msg):
print(msg.topic+" "+str(msg.payload))
client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message
client.connect(broker, 1883, 60)
thread1=threading.Thread(target=publish_1,args=(client,topic_pub))
thread1.start()
But there is no security in this implementation.
Can someone help me to setup a authentication in MQTT subscription in the WSO2 Message Broker? And i dont see any subscribed node information also in the WSO2 Message broker application https://localhost:9443/carbon