Is it possible to set up so that the consumer receives messages first from the first queue, then from the second, then from the third? That is, so that messages in different queues have different priorities. As soon as the tasks in the first queue run out, we consume messages from second queue, when the tasks in it run out, we consume messages from third queue. If at this time a message suddenly appears in the first queue, then we process it.Yes, I know that there are message priorities, but we have plans to use queues with the "quorum" type that do not support message priorities.
I tried this, but not works correctly (consumer receives 1 message from queue p1, then 1 message from queue p2, then 1 message from queue p1, then 1 message from queue p2, etc...):
$connection = new AMQPConnection(compact('host', 'port', 'login', 'password'));$connection->connect();$channel = new AMQPChannel($connection);$channel->qos(0, 1);$queue = new AMQPQueue($channel);$queue->setName('p1');$queue->consume();$queue = new AMQPQueue($channel);$queue->setName('p2');$queue->consume(function (\AMQPEnvelope $extEnvelope, \AMQPQueue $q) use ($connection) { var_dump($extEnvelope->getBody()); sleep(1); $q->ack($extEnvelope->getDeliveryTag());});