@@ -17,6 +17,9 @@ |
||
| 17 | 17 | private $exchange; |
| 18 | 18 | private $exchangeType; |
| 19 | 19 | |
| 20 | + /** |
|
| 21 | + * @param string $exchange |
|
| 22 | + */ |
|
| 20 | 23 | public function __construct( |
| 21 | 24 | $exchange, |
| 22 | 25 | $exchangeType = ExchangeType::FANOUT, |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | $this->refreshChannel(); |
| 42 | 42 | $queueBag = new SubscriberQueueBag($this->getExchange(), $this->getExchangeType(), $this->getQueueName()); |
| 43 | 43 | $this->getChannel()->exchangeDeclare($queueBag->getExchangeDeclare()); |
| 44 | - $msg = new CmobiAMQPMessage((string) $data); |
|
| 44 | + $msg = new CmobiAMQPMessage((string)$data); |
|
| 45 | 45 | $this->getChannel()->basic_publish($msg, $queueBag->getExchange()); |
| 46 | 46 | |
| 47 | 47 | $this->getChannel()->close(); |
@@ -18,6 +18,9 @@ discard block |
||
| 18 | 18 | private $correlationId; |
| 19 | 19 | private $callbackQueue; |
| 20 | 20 | |
| 21 | + /** |
|
| 22 | + * @param string $queueName |
|
| 23 | + */ |
|
| 21 | 24 | public function __construct($queueName, ConnectionManager $manager, $fromName = '') |
| 22 | 25 | { |
| 23 | 26 | $this->queueName = $queueName; |
@@ -52,7 +55,7 @@ discard block |
||
| 52 | 55 | } |
| 53 | 56 | |
| 54 | 57 | /** |
| 55 | - * @param $data |
|
| 58 | + * @param string $data |
|
| 56 | 59 | * @param int $expire |
| 57 | 60 | * @param int $priority |
| 58 | 61 | */ |
@@ -118,7 +121,7 @@ discard block |
||
| 118 | 121 | /** |
| 119 | 122 | * @todo unecessary method set, its only exists to run tests whitout stay jailed in infinite while waiting response. |
| 120 | 123 | * |
| 121 | - * @param $content |
|
| 124 | + * @param string $content |
|
| 122 | 125 | */ |
| 123 | 126 | public function setResponse($content) |
| 124 | 127 | { |
@@ -148,7 +151,7 @@ discard block |
||
| 148 | 151 | } |
| 149 | 152 | |
| 150 | 153 | /** |
| 151 | - * @return string |
|
| 154 | + * @return boolean |
|
| 152 | 155 | */ |
| 153 | 156 | public function getExchange() |
| 154 | 157 | { |
@@ -156,7 +159,7 @@ discard block |
||
| 156 | 159 | } |
| 157 | 160 | |
| 158 | 161 | /** |
| 159 | - * @return string |
|
| 162 | + * @return boolean |
|
| 160 | 163 | */ |
| 161 | 164 | public function getExchangeType() |
| 162 | 165 | { |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $queueBag = new WorkerQueueBag($this->getQueueName()); |
| 34 | 34 | $this->getChannel()->queueDeclare($queueBag->getQueueDeclare()); |
| 35 | 35 | $msg = new CmobiAMQPMessage( |
| 36 | - (string) $data, |
|
| 36 | + (string)$data, |
|
| 37 | 37 | [ |
| 38 | 38 | 'delivery_mode' => 2, // make message persistent |
| 39 | 39 | 'priority' => $priority, |
@@ -15,6 +15,9 @@ discard block |
||
| 15 | 15 | private $fromName; |
| 16 | 16 | private $queueName; |
| 17 | 17 | |
| 18 | + /** |
|
| 19 | + * @param string $queueName |
|
| 20 | + */ |
|
| 18 | 21 | public function __construct($queueName, ConnectionManager $manager, $fromName = '') |
| 19 | 22 | { |
| 20 | 23 | $this->queueName = $queueName; |
@@ -87,7 +90,7 @@ discard block |
||
| 87 | 90 | } |
| 88 | 91 | |
| 89 | 92 | /** |
| 90 | - * @return string |
|
| 93 | + * @return boolean |
|
| 91 | 94 | */ |
| 92 | 95 | public function getExchange() |
| 93 | 96 | { |
@@ -95,7 +98,7 @@ discard block |
||
| 95 | 98 | } |
| 96 | 99 | |
| 97 | 100 | /** |
| 98 | - * @return string |
|
| 101 | + * @return boolean |
|
| 99 | 102 | */ |
| 100 | 103 | public function getExchangeType() |
| 101 | 104 | { |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $queueBag = new WorkerQueueBag($this->getQueueName()); |
| 34 | 34 | $this->getChannel()->queueDeclare($queueBag->getQueueDeclare()); |
| 35 | 35 | $msg = new CmobiAMQPMessage( |
| 36 | - (string) $data, |
|
| 36 | + (string)$data, |
|
| 37 | 37 | [ |
| 38 | 38 | 'delivery_mode' => 2, // make message persistent |
| 39 | 39 | 'priority' => $priority, |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | - * @param $queueName |
|
| 29 | + * @param string $queueName |
|
| 30 | 30 | * @param QueueServiceInterface $queueService |
| 31 | 31 | * |
| 32 | 32 | * @return Queue |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace Cmobi\RabbitmqBundle\Transport\Worker; |
| 4 | 4 | |
| 5 | 5 | use Cmobi\RabbitmqBundle\Connection\ConnectionManager; |
| 6 | -use Cmobi\RabbitmqBundle\Connection\Exception\InvalidAMQPChannelException; |
|
| 7 | 6 | use Cmobi\RabbitmqBundle\Queue\Queue; |
| 8 | 7 | use Cmobi\RabbitmqBundle\Queue\QueueBagInterface; |
| 9 | 8 | use Cmobi\RabbitmqBundle\Queue\QueueBuilderInterface; |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function buildQueue($queueName, QueueServiceInterface $queueService, QueueBagInterface $queueBag) |
| 33 | 33 | { |
| 34 | - if (! $queueBag instanceof WorkerQueueBag) { |
|
| 34 | + if (!$queueBag instanceof WorkerQueueBag) { |
|
| 35 | 35 | throw new \Exception('Unsupported QueueBag'); |
| 36 | 36 | } |
| 37 | 37 | $queue = new Queue($this->getConnectionManager(), $queueBag, $this->logger); |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | public function toClosure() |
| 30 | 30 | { |
| 31 | - return function (AMQPMessage $message) { |
|
| 31 | + return function(AMQPMessage $message) { |
|
| 32 | 32 | $this->getQueueService()->handle($message); |
| 33 | 33 | |
| 34 | 34 | $message->delivery_info['channel']->basic_ack($message->delivery_info['delivery_tag']); |
@@ -129,7 +129,7 @@ |
||
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | 131 | * @param string $msg |
| 132 | - * @param null $correlationId |
|
| 132 | + * @param string $correlationId |
|
| 133 | 133 | * |
| 134 | 134 | * @return CmobiAMQPMessage |
| 135 | 135 | */ |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /** |
| 277 | - * @return string |
|
| 277 | + * @return boolean |
|
| 278 | 278 | */ |
| 279 | 279 | public function getExchange() |
| 280 | 280 | { |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /** |
| 285 | - * @return string |
|
| 285 | + * @return boolean |
|
| 286 | 286 | */ |
| 287 | 287 | public function getType() |
| 288 | 288 | { |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | - * @param $queueName |
|
| 29 | + * @param string $queueName |
|
| 30 | 30 | * @param QueueServiceInterface $queueService |
| 31 | 31 | * |
| 32 | 32 | * @return Queue |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public function buildQueue($queueName, QueueServiceInterface $queueService, QueueBagInterface $queueBag) |
| 32 | 32 | { |
| 33 | - if (! $queueBag instanceof RpcQueueBag) { |
|
| 33 | + if (!$queueBag instanceof RpcQueueBag) { |
|
| 34 | 34 | throw new \Exception('Unsupported QueueBag'); |
| 35 | 35 | } |
| 36 | 36 | $queue = new Queue($this->getConnectionManager(), $queueBag, $this->logger); |
@@ -62,10 +62,10 @@ |
||
| 62 | 62 | $this->parameters['user'], |
| 63 | 63 | $this->parameters['password'], |
| 64 | 64 | $this->parameters['vhost'], |
| 65 | - false, // insist |
|
| 65 | + false, // insist |
|
| 66 | 66 | 'AMQPLAIN', // login_method |
| 67 | - null, // login_response |
|
| 68 | - 'en_US', // locale |
|
| 67 | + null, // login_response |
|
| 68 | + 'en_US', // locale |
|
| 69 | 69 | $this->parameters['connection_timeout'], |
| 70 | 70 | $this->parameters['read_write_timeout'], |
| 71 | 71 | $this->parameters['ssl_context'], |