Type hint on Envelope::getHeader breaks dead letter exchange usage #106
Closed
Description
Hello,
I'm upgrading from 1.4.0 to 2.1.0 and I have an error when a message is redelivered to the queue from a dead letter exchange
Return value of Humus\Amqp\Driver\PhpAmqpLib\Envelope::getHeader() must be of the type string or null, array returned
.#0 /var/www/mister-auto.com/git/maws/src/Maws/Core/Base/Bus/AMQPConsumer.php(101): Humus\Amqp\Driver\PhpAmqpLib\Envelope->getHeader()
As we can read on the official doc:
The dead-lettering process adds an array to the header of each dead-lettered message named x-death.
I also checked the message and this is the content of the x-death
header:
headers:
x-death:
count: 1
exchange: error_dlx
queue: error_dlx
reason: expired
routing-keys: test_queue
time: 1686218983
count: 1
reason: rejected
queue: test_queue
time: 1686218980
exchange:
routing-keys: test_queue
It seems to me that a header can be string or array (maybe more) and we should therefore remove the type hint in this case.
I can absolutely make the PR. But maybe am I missing something ?
PS: I run with rabbitmq in version 3.6.16 but I also tested it with 3.10.7 with same results.
Metadata
Assignees
Labels
No labels