Take a DCCS Key of DataHub as an example to illustrate the troubleshooting process of MQTT connection abnormality.
Problem description
If you find that the data cannot be uploaded to RabbitMQ. You can use MQTT Tools such as Paho or MQTTBox to test the MQTT connection information.
MQTT connection credential
You can refer to this document for retrieving connection credential through DCCS API. Retrieve a Credential of Connection Through API
MQTT URL: rabbitmq-001-pub.hz.wise-paas.com.cn
MQTT Port: 1883
username: eaa7d8b1-f785-4c05-9857-9f7f7c1078f3:cab56b42-0616-4373-819a-5bc9ff7edff8
password: dyGekuVaeMbfluGJ6hXts46WI
Investigation process
- First check the RabbitMQ service connection
telnet rabbitmq-001-pub.hz.wise-paas.com.cn 1883
- Use MQTT.fx to check MQTT connection
-
Create a connection
-
Connection testing
-
log shows that the connection is successful
- Subscription and publishing troubleshooting
-Enter the subscription topic at will, such as: /home/garden/fountain, and click “Subscribe”, then the connection is disconnected, check the log
The preliminary judgment is that there is a topic whitelist in RabbitMQ. The method of querying the whitelist is as follows:
- Method 1: RabbitMQ admin permission is required
Log in to RabbitMQ management portal, filter by username in the Admin tab, and find that this account has a topic whitelist.
- Method 2: Using the ServiceKeyName directly obtain the topic whitelist through the DCCS API
How to get the ServiceKeyName
Login in to service portal
Call API to get credential information and check the rmqTopicRead and rmqTopicWrite configuration
https://api-dccs-ensaas.hz.wise-paas.com.cn/v1/servicecredentials/${ServiceKey}
Subscribe and publish via topic whitelist
-Replace “.” with “/” and “*” with “#” in the whitelist, as follows:
.wisepaas.scada.caaa2f99-c604-4d70-a4eb-6a8e3869c33b.*
==>
/wisepaas/scada/caaa2f99-c604-4d70-a4eb-6a8e3869c33b/#
-
Subscribe
-
Publish