Hi,
I've deployed an EMQX cluster with the auth JWT plugin. Everything seems to work well as my client programm (written in python using paho.mqtt library) is able to connect to the broker and subscribe to a wildcard topic (in my case: E01/COMMANDS/#). Now the problem I'm facing is that whenever I publish a message on i.e E01/COMMANDS/REGISTER, the message is correctly received by the broker (see figure)
But those messages are never consumed by the client and therefore commands not treated... I was wondering whether anyone has faced this problem?
My subscription is handled the following way:
self.mqtt_username = DEVICE_ID
self.mqtt_password = response.json()['accessToken']
self.mqtt_broker_url = MQTT_BROKER_URL
self.mqtt_broker_port = MQTT_BROKER_PORT
self.mqtt_client = mqtt.Client(MQTT_CLIENT_ID, clean_session=False)
self.mqtt_client.username_pw_set(self.mqtt_username, self.mqtt_password)
self.mqtt_client.on_connect = self.on_connect
self.mqtt_client.on_message = self.on_message
self.mqtt_client.on_disconnect = self.on_disconnect
""" FOR Now, unused callbacks"""
self.mqtt_client.on_publish = self.on_publish
self.mqtt_client.on_subscribe = self.on_subscribe
self.mqtt_client.on_log = self.on_log
## Sets last will and testament to indicate if the is offline due to deconnection
self.mqtt_client.will_set(STATUS_TOPIC, payload="offline", qos=2, retain=True)
...
...
self.mqtt_client.connect(self.mqtt_broker_url,
port=self.mqtt_broker_port,
keepalive=60,
session_expiry=60)
self.mqtt_client.loop_start()
self._logger.info(f"MQTT client connected to broker {self.mqtt_broker_url}:{self.mqtt_broker_port}")
And the subscription is set in on_connect callback as following:
you're not providing enough information for anyone to say anything useful.
You claim the publish worked... graphic shows that somebody published something, how do you know it is the message that you published, or that the message is correct?
can you print the content of a sample message on the broker?
If the broker has no traffic you can set COMMAND_TOPIC to '#' and see if you get any messages.
You aren't checking the result of the subscribe... did the subscribe succeed?
Hi, I've deployed an EMQX cluster with the auth JWT plugin. Everything seems to work well as my client programm (written in python using paho.mqtt library) is able to connect to the broker and subscribe to a wildcard topic (in my case: E01/COMMANDS/#). Now the problem I'm facing is that whenever I publish a message on i.e E01/COMMANDS/REGISTER, the message is correctly received by the broker (see figure)
But those messages are never consumed by the client and therefore commands not treated... I was wondering whether anyone has faced this problem? My subscription is handled the following way:
And the subscription is set in on_connect callback as following:
Where COMMAND_TOPIC is 'E01/COMMANDS/#'