@@ 140-161 (lines=22) @@ | ||
137 | /** |
|
138 | * @throws AMQPProtocolChannelException |
|
139 | */ |
|
140 | public function bind() |
|
141 | { |
|
142 | if (!isset($this->attributes['bind']) || empty($this->attributes['bind'])) { |
|
143 | return; |
|
144 | } |
|
145 | foreach ($this->attributes['bind'] as $bindItem) { |
|
146 | try { |
|
147 | $this->getChannel() |
|
148 | ->queue_bind( |
|
149 | $bindItem['queue'], |
|
150 | $this->attributes['name'], |
|
151 | $bindItem['routing_key'] |
|
152 | ); |
|
153 | } catch (AMQPProtocolChannelException $e) { |
|
154 | // 404 is the code for trying to bind to an non-existing entity |
|
155 | if (true === $this->attributes['throw_exception_on_bind_fail'] || $e->amqp_reply_code !== 404) { |
|
156 | throw $e; |
|
157 | } |
|
158 | $this->getConnection()->reconnect(); |
|
159 | } |
|
160 | } |
|
161 | } |
|
162 | ||
163 | /** |
|
164 | * Delete the queue |
@@ 196-217 (lines=22) @@ | ||
193 | } |
|
194 | } |
|
195 | ||
196 | public function bind() |
|
197 | { |
|
198 | if (!isset($this->attributes['bind']) || empty($this->attributes['bind'])) { |
|
199 | return; |
|
200 | } |
|
201 | foreach ($this->attributes['bind'] as $bindItem) { |
|
202 | try { |
|
203 | $this->getChannel() |
|
204 | ->queue_bind( |
|
205 | $this->attributes['name'], |
|
206 | $bindItem['exchange'], |
|
207 | $bindItem['routing_key'] |
|
208 | ); |
|
209 | } catch (AMQPProtocolChannelException $e) { |
|
210 | // 404 is the code for trying to bind to an non-existing entity |
|
211 | if (true === $this->attributes['throw_exception_on_bind_fail'] || $e->amqp_reply_code !== 404) { |
|
212 | throw $e; |
|
213 | } |
|
214 | $this->reconnect(); |
|
215 | } |
|
216 | } |
|
217 | } |
|
218 | ||
219 | /** |
|
220 | * Delete the queue |