1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-08 22:26:41 +02:00

Fix setting of extra attributes in AmqpHandler when handling batches of records (#1781)

One of content_type, content_encoding, message_id, user_id, app_id, delivery_mode, priority, timestamp, expiration, type or reply_to, headers.

Co-authored-by: Попов Михаил <popov.mv@betcity.ru>
This commit is contained in:
Mikhail Popov
2023-02-04 17:46:32 +03:00
committed by GitHub
parent e937256eee
commit 58f503004d

View File

@@ -151,13 +151,14 @@ class AmqpHandler extends AbstractProcessingHandler
private function createAmqpMessage(string $data): AMQPMessage
{
return new AMQPMessage(
$data,
[
'delivery_mode' => 2,
'content_type' => 'application/json',
]
);
$attributes = [
'delivery_mode' => 2,
'content_type' => 'application/json',
];
if ($this->extraAttributes) {
$attributes = array_merge($attributes, $this->extraAttributes);
}
return new AMQPMessage($data, $attributes);
}
/**