diff --git a/RabbitMq/Producer.php b/RabbitMq/Producer.php index 446bb611..34bd66af 100644 --- a/RabbitMq/Producer.php +++ b/RabbitMq/Producer.php @@ -13,6 +13,12 @@ class Producer extends BaseAmqp implements ProducerInterface protected $contentType = 'text/plain'; protected $deliveryMode = 2; + /** + * Set content type + * + * @param string $contentType + * @return self + */ public function setContentType($contentType) { $this->contentType = $contentType; @@ -20,6 +26,12 @@ public function setContentType($contentType) return $this; } + /** + * Set delivery mode + * + * @param string $deliveryMode + * @return self + */ public function setDeliveryMode($deliveryMode) { $this->deliveryMode = $deliveryMode; @@ -46,7 +58,7 @@ public function publish($msgBody, $routingKey = '', $additionalProperties = arra $this->setupFabric(); } - $msg = new AMQPMessage((string) $msgBody, array_merge($this->getBasicProperties(), $additionalProperties)); + $msg = new AMQPMessage((string)$msgBody, array_merge($this->getBasicProperties(), $additionalProperties)); if (!empty($headers)) { $headersTable = new AMQPTable($headers); diff --git a/RabbitMq/ProducerInterface.php b/RabbitMq/ProducerInterface.php index b4e166c1..5e38a8c5 100644 --- a/RabbitMq/ProducerInterface.php +++ b/RabbitMq/ProducerInterface.php @@ -5,11 +5,28 @@ interface ProducerInterface { /** - * Publish a message + * Set content type + * + * @param string $contentType + * @return self + */ + public function setContentType($contentType); + + /** + * Set delivery mode + * + * @param string $deliveryMode + * @return self + */ + public function setDeliveryMode($deliveryMode); + + /** + * Publishes the message and merges additional properties with basic properties * * @param string $msgBody * @param string $routingKey * @param array $additionalProperties + * @param array $headers */ - public function publish($msgBody, $routingKey = '', $additionalProperties = array()); + public function publish($msgBody, $routingKey = '', $additionalProperties = array(), array $headers = null); }