Skip to content

Commit 17870ba

Browse files
author
Paul Kamer
committed
Adds getter for basic properties, to ensure properties set with setters are used
1 parent eb620fa commit 17870ba

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

RabbitMq/Producer.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ public function setDeliveryMode($deliveryMode)
2626

2727
return $this;
2828
}
29-
29+
30+
protected function getBasicProperties()
31+
{
32+
return array('content_type' => $this->contentType, 'delivery_mode' => $this->deliveryMode);
33+
}
34+
3035
/**
3136
* Publishes the message and merges additional properties with basic properties
3237
*
@@ -40,7 +45,7 @@ public function publish($msgBody, $routingKey = '', $additionalProperties = arra
4045
$this->setupFabric();
4146
}
4247

43-
$msg = new AMQPMessage((string) $msgBody, array_merge($this->basicProperties, $additionalProperties));
48+
$msg = new AMQPMessage((string) $msgBody, array_merge($this->getBasicProperties(), $additionalProperties));
4449
$this->ch->basic_publish($msg, $this->exchangeOptions['name'], (string) $routingKey);
4550
}
4651
}

0 commit comments

Comments
 (0)