AMQP Client Access
After configuring and activating rules by calling the platform APIs Creating a Rule Trigger Condition, Creating a Rule Action, and Modifying a Rule Trigger Condition, connect the AMQP client to the IoT platform. Then run the AMQP client on your server to receive subscribed-to messages.
Connection Establishment and Authentication
- The AMQP client establishes a TCP connection with the platform and performs TLS handshake verification.
To ensure security, the AMQP client must use TLS1.2 or a later version for encryption. Non-encrypted TCP transmission is not supported.
- The client requests to set up a connection.
- The client sends a request to the platform to establish a receiver link (a unidirectional channel for the platform to push data to the client).
The receiver link must be set up within 15 seconds after the connection is set up on the client. Otherwise, the platform will close the connection.
After the receiver link is set up, the client is connected to the platform.
Only one receiver link can be created for a connection, and sender links cannot be created. Therefore, the platform can push messages to the client, but the client cannot send messages to the platform.
Connection Configuration Parameters
The table below describes the connection address and connection authentication parameters for the AMQP client to connect to the platform.
-
AMQP access domain name: amqps://${UUCID}.iot-amqps.cn-north-4.myhuaweicloud.com
-
Connection string: amqps://${UUCID}.iot-amqps.cn-north-4.myhuaweicloud.com :5671?amqp.vhost=default&amqp.idleTimeout=8000&amqp.saslMechanisms=PLAIN
Parameter
Description
UUCID
Short for unique user connect ID, which is automatically generated for each account. You can view the UUCID on the Overview page of the IoTDA console.

amqp.vhost
Currently, AMQP uses the default host. Only the default host is supported.
amqp.saslMechanisms
Connection authentication mode. Currently, PLAIN-SASL is supported.
idle-time-out
Heartbeat interval, in milliseconds. If the heartbeat interval expires and no frame is transmitted on the connection, the platform closes the connection.
- Port: 5671
- Client identity authentication parameters
username = "accessKey=${accessKey}|timestamp=1599116822987|"
password = "${accessCode}"
Parameter
Mandatory or Optional
Description
accessKey
Mandatory
An accessKey can be used to establish a maximum of 32 concurrent connections. When establishing a connection for the first time, preset the parameter by following the instructions provided in Obtaining the AMQP Access Credential.
timestamp
Mandatory
Indicates the current time. The value is a 13-digit timestamp, accurate to milliseconds.
The server verifies the client timestamp. There is a 5-minute difference between the client timestamp and server timestamp.
accessCode
Mandatory
The value can contain a maximum of 256 characters. When establishing a connection for the first time, preset the parameter by following the instructions provided in Resources. If the accessCode is lost, you can call the API Generating an Access Token or follow the instructions provided in Obtaining the AMQP Access Credential to reset the accessCode.
Obtaining the AMQP Access Credential
If an application uses AMQP to access the platform for data transfer, preset an access credential. You can call the API Generating an Access Credential or use the console to preset an access credential. The procedure for using the console to generate an access credential is as follows:
- In the navigation pane, click IoTDA Instances. On the page displayed, click Details under Basic Edition to access the details.
- Click Preset Access Credential to preset the accessCode and accessKey.

If you already have an access credential, the accessKey cannot be used after you preset the access credential again.
Connection Specifications
|
Key |
Documentation |
|---|---|
|
Maximum number of queues that can be connected to a connection |
10 |
|
Maximum number of queues for a user |
100 |
|
Maximum number of connections for a tenant |
32 |
|
Maximum number of cached messages for an IoTDA instance |
9,000 |
|
Maximum number of concurrent connections |
1,000 |
|
Cache duration of a message (days) |
1 |
Receiving Push Messages
After the receiver link between the client and platform is established, the client can proactively pull data or register a listener to enable the platform to push data. The proactive mode is recommended, because the client can pull data based on its own capability.
Last Article: Configuring AMQP Server Subscription
Next Article: Java SDK Access Example
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.