This topic describes the cause and troubleshooting method of a QueueHasDiffField error that is reported on an ApsaraMQ for RabbitMQ client.
Symptoms
When I attempt to access an ApsaraMQ for RabbitMQ broker from an ApsaraMQ for RabbitMQ client, a QueueHasDiffField error, such as QueueHasDiffField[OAutoDelete=false&NAutoDelete=true;], is reported.
In the error information, the parameter that starts with O indicates an attribute value of the queue to use, and the parameter that starts with N indicates an attribute value of the declared queue.
Causes
An attribute value of the queue to use is inconsistent with that of the declared queue. The following table describes the attribute parameters that may be inconsistent.
Parameter | Data type | Description |
queue | String | The name of the queue. |
durable | Boolean | Specifies whether the queue is durable:
Note By default, a queue is persistent, regardless of whether it is created by calling the CreateQueue API operation or performing operations on the Queues page of the ApsaraMQ for RabbitMQ console. |
exclusive | Boolean | Specifies whether the queue is exclusive:
|
autoDelete | Boolean | Specifies whether the queue can be automatically deleted:
|
arguments | Map | Other parameters of the queue, including the dead-letter exchange, dead-letter routing key, and message TTL. |
For example, if the value of autoDelete for the queue to use is inconsistent with that of the declared queue, QueueHasDiffField[OAutoDelete=false&NAutoDelete=true;] is reported.
The value of autoDelete for the queue to use is false.
NoteYou can call the ListQueues API operation or perform operations on the Queues page of the ApsaraMQ for RabbitMQ console to obtain the values of the attribute parameters for the queue.
The value of autoDelete for the declared queue is true.
Sample code:
channel.queueDeclare("test", false, false, true, null);
Solutions
Change the inconsistent value in the declaration code to ensure that it is consistent with that of the queue to use. In this example, change the value of autoDelete to false.
Sample code:
channel.queueDeclare("test", false, false, false, null);