I am trying to switch my task queue to utilize priority support, I was able to set the x-max-priority value creating the task, but when I try to fetch a task, it is throwing an error.
Is there a special way to fetch the task using a consumer?
$channel->queue_declare('task_queue', false, true, false, false);
PhpAmqpLib\Exception\AMQPProtocolChannelException' with message 'PRECONDITION_FAILED - inequivalent arg 'x-max-priority' for queue 'task_queue' in vhost 'vhost': received none but current is the value '100' of type 'signedint'' in /var/www/html/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AMQPChannel.php:188
答案 0 :(得分:0)
You need to $channel->queue_declare
with identical parameters on both sides.
So you must set the priority property on both sides like
$channel->queue_declare('task_queue', false, true, false, false, false, $parameters);
where $parameters
is an array declared like
$parameters = [
'x-max-priority' => ['I', 100],
];