I'm using different "Per Message TTL" in RabbitMQ queue, and I expect that messages with different TTL should be processed by consumer in due time.
To provide this behaviour, I use RabbitMQ queue with huge "x-message-ttl", I add messages to this queue with own value of "Per Message TTL"(see code below). For example add to queue messages with TTL 30, 20 and 10 seconds.
The problem in behaviour, how RabbitMQ process the messages with different "Per MessageTTL" in queue, the messages with largest TTL stop the messages with less TTL. So consumer process all mesages together, when largest TTL expire.
Publish message code:
$channel = new AMQPChannel($this->connection);
$exchange = new AMQPExchange($channel);
$exchange->setName($exchangeName);
$exchange->setType(AMQP_EX_TYPE_DIRECT);
$ttl = $ttl*1000;
$params = array('expiration'=>$ttl);
$message = $exchange->publish($msg, $this->queueNotDelayedName, null, $params);