Skip to content

Commit ead4230

Browse files
committed
Only set headers if they are not empty on publish message
1 parent 0a2bd15 commit ead4230

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

RabbitMq/Producer.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ public function publish($msgBody, $routingKey = '', $additionalProperties = arra
4949

5050
$msg = new AMQPMessage((string) $msgBody, array_merge($this->getBasicProperties(), $additionalProperties));
5151

52-
$headersTable = new AMQPTable($headers);
53-
$msg->set('application_headers', $headersTable);
52+
if(!empty($headers)){
53+
$headersTable = new AMQPTable($headers);
54+
$msg->set('application_headers', $headersTable);
55+
}
5456

5557
$this->getChannel()->basic_publish($msg, $this->exchangeOptions['name'], (string) $routingKey);
5658
}

0 commit comments

Comments
 (0)