@@ 151-172 (lines=22) @@ | ||
148 | /** |
|
149 | * @throws AMQPProtocolChannelException |
|
150 | */ |
|
151 | public function bind() |
|
152 | { |
|
153 | if (!isset($this->attributes['bind']) || empty($this->attributes['bind'])) { |
|
154 | return; |
|
155 | } |
|
156 | foreach ($this->attributes['bind'] as $bindItem) { |
|
157 | try { |
|
158 | $this->getChannel() |
|
159 | ->queue_bind( |
|
160 | $bindItem['queue'], |
|
161 | $this->attributes['name'], |
|
162 | $bindItem['routing_key'] |
|
163 | ); |
|
164 | } catch (AMQPProtocolChannelException $e) { |
|
165 | // 404 is the code for trying to bind to an non-existing entity |
|
166 | if (true === $this->attributes['throw_exception_on_bind_fail'] || $e->amqp_reply_code !== 404) { |
|
167 | throw $e; |
|
168 | } |
|
169 | $this->getConnection()->reconnect(); |
|
170 | } |
|
171 | } |
|
172 | } |
|
173 | ||
174 | /** |
|
175 | * Delete the queue |
@@ 207-228 (lines=22) @@ | ||
204 | } |
|
205 | } |
|
206 | ||
207 | public function bind() |
|
208 | { |
|
209 | if (!isset($this->attributes['bind']) || empty($this->attributes['bind'])) { |
|
210 | return; |
|
211 | } |
|
212 | foreach ($this->attributes['bind'] as $bindItem) { |
|
213 | try { |
|
214 | $this->getChannel() |
|
215 | ->queue_bind( |
|
216 | $this->attributes['name'], |
|
217 | $bindItem['exchange'], |
|
218 | $bindItem['routing_key'] |
|
219 | ); |
|
220 | } catch (AMQPProtocolChannelException $e) { |
|
221 | // 404 is the code for trying to bind to an non-existing entity |
|
222 | if (true === $this->attributes['throw_exception_on_bind_fail'] || $e->amqp_reply_code !== 404) { |
|
223 | throw $e; |
|
224 | } |
|
225 | $this->reconnect(); |
|
226 | } |
|
227 | } |
|
228 | } |
|
229 | ||
230 | /** |
|
231 | * Delete the queue |