I am new guy in use MQTT, when I publish message use qos=1 I could recevice message correct.but when I try to publish message use qos=2 I got nothing.this was my test code ,I try use rabbit mq (MQTT)
Subscribe:
def MQTT_CONNECTION():
print("IN mqtt connection")
client = mqtt.Client()
client.username_pw_set(user, pwd)
client.connect("localhost", 1883, 60)
client.on_connect = on_connect
client.on_message = on_message
client.subscribe([("TEST", 2)])
MQTT_CLIENT_CONNECTED=True
print('in function'+str(stop))
client.loop_forever()
except Exception as error:
print("ERROR IN MQTT CONNECTION",error)
MQTT_CLIENT_CONNECTED=False
Publish code:
client.publish("TEST",2111,qos=2,retain=True)
when the qos set to 1 subscribe code could receive messsage, when I try to change the qos =2 I got nothing Please give me some help . Thanks