1 | <?php |
||
19 | class Queue implements QueueInterface |
||
20 | { |
||
21 | /** |
||
22 | * @var Channel |
||
23 | */ |
||
24 | protected $channel; |
||
25 | /** |
||
26 | * @var Options\QueueOptions |
||
27 | */ |
||
28 | protected $options; |
||
29 | /** |
||
30 | * @var MessageMapper |
||
31 | */ |
||
32 | protected $messageMapper; |
||
33 | |||
34 | /** |
||
35 | * Declare a new queue on the broker. |
||
36 | * |
||
37 | * @return integer the message count. |
||
38 | */ |
||
39 | 1 | public function declareQueue() |
|
53 | |||
54 | /** |
||
55 | * Bind the given queue to a routing key on an exchange. |
||
56 | * |
||
57 | * @param string $exchangeName Name of the exchange to bind to. |
||
58 | * @param string $routingKey Pattern or routing key to bind with. |
||
59 | * @param bool $noWait No wait for a reply |
||
60 | * @param array $arguments Additional binding arguments. |
||
61 | * |
||
62 | * @return boolean |
||
63 | */ |
||
64 | 2 | public function bind($exchangeName, $routingKey = null, $noWait = false, array $arguments = []) |
|
74 | |||
75 | /** |
||
76 | * Remove a routing key binding on an exchange from the given queue. |
||
77 | * |
||
78 | * @param string $exchangeName The name of the exchange on which the |
||
79 | * queue is bound. |
||
80 | * @param string $routingKey The binding routing key used by the |
||
81 | * queue. |
||
82 | * @param array $arguments Additional binding arguments. |
||
83 | * |
||
84 | * @return $this |
||
85 | */ |
||
86 | 2 | public function unbind($exchangeName, $routingKey = null, array $arguments = []) |
|
96 | |||
97 | /** |
||
98 | * Acknowledge the receipt of a message. |
||
99 | * |
||
100 | * @param string $deliveryTag The message delivery tag of which to |
||
101 | * acknowledge receipt. |
||
102 | * @param bool $multiple Acknowledge all previous |
||
103 | * unacked messages as well. |
||
104 | * |
||
105 | * @return $this |
||
106 | */ |
||
107 | 2 | public function ack($deliveryTag, $multiple = false) |
|
113 | |||
114 | /** |
||
115 | * Mark a message as explicitly not acknowledged. |
||
116 | * |
||
117 | * Mark the message identified by delivery_tag as explicitly not |
||
118 | * acknowledged. This method can only be called on messages that have not |
||
119 | * yet been acknowledged. When called, the broker will immediately put the |
||
120 | * message back onto the queue, instead of waiting until the connection is |
||
121 | * closed. This method is only supported by the RabbitMQ broker. The |
||
122 | * behavior of calling this method while connected to any other broker is |
||
123 | * undefined. |
||
124 | * |
||
125 | * @param string $deliveryTag Delivery tag of last message to reject. |
||
126 | * @param bool $requeue Requeue the message(s). |
||
127 | * @param bool $multiple Mark as not acknowledge all previous |
||
128 | * unacked messages as well. |
||
129 | * |
||
130 | * @return $this |
||
131 | */ |
||
132 | 4 | public function nack($deliveryTag, $requeue = false, $multiple = false) |
|
138 | |||
139 | /** |
||
140 | * Mark one message as explicitly not acknowledged. |
||
141 | * |
||
142 | * Mark the message identified by delivery_tag as explicitly not |
||
143 | * acknowledged. This method can only be called on messages that have not |
||
144 | * yet been acknowledged. |
||
145 | * |
||
146 | * @param string $deliveryTag Delivery tag of the message to reject. |
||
147 | * @param bool $requeue Requeue the message(s). |
||
148 | * |
||
149 | * @return $this |
||
150 | */ |
||
151 | 2 | public function reject($deliveryTag, $requeue = false) |
|
157 | |||
158 | /** |
||
159 | * Purge the contents of a queue. |
||
160 | * |
||
161 | * @return $this |
||
162 | */ |
||
163 | 1 | public function purge() |
|
169 | |||
170 | /** |
||
171 | * Cancel a queue that is already bound to an exchange and routing key. |
||
172 | * |
||
173 | * @param string $consumerTag The queue name to cancel, if the queue |
||
174 | * object is not already representative of |
||
175 | * a queue. |
||
176 | * |
||
177 | * @return $this |
||
178 | */ |
||
179 | 1 | public function cancel($consumerTag = '') |
|
185 | |||
186 | /** |
||
187 | * Delete a queue from the broker. |
||
188 | * |
||
189 | * This includes its entire contents of unread or unacknowledged messages. |
||
190 | * |
||
191 | * @param bool $ifUnused Optionally $ifUnused can be specified |
||
192 | * to indicate the queue should not be |
||
193 | * deleted until no clients are connected to |
||
194 | * it. |
||
195 | * @param bool $ifEmpty Optionally $ifUnused can be specified |
||
196 | * to indicate the queue should not be |
||
197 | * deleted until it's empty |
||
198 | * @param bool $noWait No wait for a reply |
||
199 | * |
||
200 | * @return $this |
||
201 | * @throws Exception\InvalidArgumentException |
||
202 | */ |
||
203 | 8 | public function delete($ifUnused = false, $ifEmpty = false, $noWait = false) |
|
209 | |||
210 | /** |
||
211 | * Retrieve the next message from the queue. |
||
212 | * |
||
213 | * @param bool $autoAck |
||
214 | * @return null|Message |
||
215 | * @throws \OutOfBoundsException |
||
216 | */ |
||
217 | 2 | public function get($autoAck = false) |
|
227 | |||
228 | /** |
||
229 | * @return Options\QueueOptions |
||
230 | */ |
||
231 | 6 | public function getOptions() |
|
235 | |||
236 | /** |
||
237 | * @param Options\QueueOptions $options |
||
238 | * @return $this |
||
239 | */ |
||
240 | 29 | public function setOptions(Options\QueueOptions $options) |
|
245 | |||
246 | /** |
||
247 | * @return MessageMapper |
||
248 | */ |
||
249 | 5 | public function getMessageMapper() |
|
256 | |||
257 | /** |
||
258 | * @param MessageMapper $messageMapper |
||
259 | * @return $this |
||
260 | */ |
||
261 | 5 | public function setMessageMapper(MessageMapper $messageMapper) |
|
266 | |||
267 | /** |
||
268 | * Consume messages from a queue. |
||
269 | * |
||
270 | * @param string $consumerTag A string describing this consumer. Used |
||
271 | * for canceling subscriptions with cancel(). |
||
272 | * @param bool $noLocal |
||
273 | * @param bool $autoAck |
||
274 | * @param bool $exclusive |
||
275 | * @param bool $nowait No wait for a reply. |
||
276 | * @param callback|ConsumerInterface|null $callback A callback function to which the |
||
277 | * consumed message will be passed. |
||
278 | * @return $this |
||
279 | */ |
||
280 | 3 | public function consume( |
|
305 | |||
306 | /** |
||
307 | * Get the Channel object in use |
||
308 | * |
||
309 | * @return ChannelInterface |
||
310 | */ |
||
311 | 1 | public function getChannel() |
|
315 | |||
316 | /** |
||
317 | * @param Channel $channel |
||
318 | * @return $this |
||
319 | */ |
||
320 | 30 | public function setChannel(Channel $channel) |
|
325 | |||
326 | /** |
||
327 | * Get the Connection object in use |
||
328 | * |
||
329 | * @return ConnectionInterface |
||
330 | */ |
||
331 | 1 | public function getConnection() |
|
335 | } |
||
336 |