@@ -22,6 +22,10 @@ discard block |
||
22 | 22 | private $correlationId; |
23 | 23 | private $callbackQueue; |
24 | 24 | |
25 | + /** |
|
26 | + * @param string $queueName |
|
27 | + * @param string $fromName |
|
28 | + */ |
|
25 | 29 | public function __construct($queueName, ConnectionManager $manager, $fromName, $connectionName = 'default') |
26 | 30 | { |
27 | 31 | $this->connectionName = $connectionName; |
@@ -43,7 +47,7 @@ discard block |
||
43 | 47 | } |
44 | 48 | |
45 | 49 | /** |
46 | - * @param $data |
|
50 | + * @param string $data |
|
47 | 51 | * @param int $expire |
48 | 52 | * @param int $priority |
49 | 53 | * @throws QueueNotFoundException |
@@ -133,7 +137,7 @@ discard block |
||
133 | 137 | /** |
134 | 138 | * @todo unecessary method set, its only exists to run tests whitout stay jailed in infinite while waiting response. |
135 | 139 | * |
136 | - * @param $content |
|
140 | + * @param string $content |
|
137 | 141 | */ |
138 | 142 | public function setResponse($content) |
139 | 143 | { |
@@ -163,7 +167,7 @@ discard block |
||
163 | 167 | } |
164 | 168 | |
165 | 169 | /** |
166 | - * @return string |
|
170 | + * @return boolean |
|
167 | 171 | */ |
168 | 172 | public function getExchange() |
169 | 173 | { |
@@ -171,7 +175,7 @@ discard block |
||
171 | 175 | } |
172 | 176 | |
173 | 177 | /** |
174 | - * @return string |
|
178 | + * @return boolean |
|
175 | 179 | */ |
176 | 180 | public function getExchangeType() |
177 | 181 | { |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace Cmobi\RabbitmqBundle\Transport\Rpc; |
4 | 4 | |
5 | 5 | use Cmobi\RabbitmqBundle\Connection\CmobiAMQPChannel; |
6 | -use Cmobi\RabbitmqBundle\Connection\CmobiAMQPConnection; |
|
7 | 6 | use Cmobi\RabbitmqBundle\Connection\ConnectionManager; |
8 | 7 | use Cmobi\RabbitmqBundle\Queue\CmobiAMQPMessage; |
9 | 8 | use Cmobi\RabbitmqBundle\Queue\QueueProducerInterface; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $connection = $this->connectionManager->getConnection($this->connectionName); |
56 | 56 | $channel = $connection->channel(); |
57 | 57 | |
58 | - if (! $this->queueHasExists($channel)) { |
|
58 | + if (!$this->queueHasExists($channel)) { |
|
59 | 59 | throw new QueueNotFoundException("Queue $this->queueName not declared."); |
60 | 60 | } |
61 | 61 | $this->correlationId = $this->generateCorrelationId(); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | [$this, 'onResponse'] |
81 | 81 | ); |
82 | 82 | $msg = new CmobiAMQPMessage( |
83 | - (string) $data, |
|
83 | + (string)$data, |
|
84 | 84 | [ |
85 | 85 | 'correlation_id' => $this->correlationId, |
86 | 86 | 'reply_to' => $this->callbackQueue, |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ); |
90 | 90 | $channel->basic_publish($msg, '', $this->getQueueName()); |
91 | 91 | |
92 | - while (! $this->response) { |
|
92 | + while (!$this->response) { |
|
93 | 93 | $channel->wait(null, 0, ($expire / 1000)); |
94 | 94 | } |
95 | 95 | $channel->close(); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | /** @return string */ |
152 | 152 | public function generateCorrelationId() |
153 | 153 | { |
154 | - return uniqid($this->getQueueName()) . Uuid::uuid4()->toString() . microtime(); |
|
154 | + return uniqid($this->getQueueName()).Uuid::uuid4()->toString().microtime(); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -143,17 +143,17 @@ |
||
143 | 143 | do { |
144 | 144 | try { |
145 | 145 | $failed = false; |
146 | - fwrite($this->logOutput, 'start Queue::forceReconnect() - trying connect...' . PHP_EOL); |
|
146 | + fwrite($this->logOutput, 'start Queue::forceReconnect() - trying connect...'.PHP_EOL); |
|
147 | 147 | $this->connection = $this->getConnectionManager()->getConnection($this->connectionName); |
148 | 148 | $this->channel = $this->getConnection()->channel(); |
149 | 149 | $this->createQueue(); |
150 | 150 | } catch (\Exception $e) { |
151 | 151 | $failed = true; |
152 | 152 | sleep(3); |
153 | - fwrite($this->logOutput, 'failed Queue::forceReconnect() - ' . $e->getMessage() . PHP_EOL); |
|
153 | + fwrite($this->logOutput, 'failed Queue::forceReconnect() - '.$e->getMessage().PHP_EOL); |
|
154 | 154 | } |
155 | 155 | } while ($failed); |
156 | - fwrite($this->logOutput, 'Queue::forceReconnect() - connected!' . PHP_EOL); |
|
156 | + fwrite($this->logOutput, 'Queue::forceReconnect() - connected!'.PHP_EOL); |
|
157 | 157 | |
158 | 158 | return $this->channel; |
159 | 159 | } |