1 | <?php |
||
14 | class Channel implements ChannelInterface |
||
15 | { |
||
16 | /** |
||
17 | * @var \AMQPChannel |
||
18 | */ |
||
19 | protected $resource; |
||
20 | /** |
||
21 | * @var Connection |
||
22 | */ |
||
23 | protected $connection; |
||
24 | /** |
||
25 | * @var Exchange |
||
26 | */ |
||
27 | protected $exchangePrototype; |
||
28 | /** |
||
29 | * @var Queue |
||
30 | */ |
||
31 | protected $queuePrototype; |
||
32 | |||
33 | /** |
||
34 | * Channel constructor. |
||
35 | * |
||
36 | * @param Exchange $exchangePrototype |
||
37 | * @param Queue $queuePrototype |
||
38 | */ |
||
39 | 32 | public function __construct(Exchange $exchangePrototype = null, Queue $queuePrototype = null) |
|
44 | |||
45 | /** |
||
46 | * @param Exchange $exchange |
||
47 | */ |
||
48 | 32 | public function registerExchange(Exchange $exchange) |
|
52 | |||
53 | /** |
||
54 | * @param Queue $queue |
||
55 | */ |
||
56 | 32 | public function registerQueue(Queue $queue) |
|
60 | |||
61 | /** |
||
62 | * Check the channel connection. |
||
63 | * |
||
64 | * @return bool Indicates whether the channel is connected. |
||
65 | */ |
||
66 | 1 | public function isConnected() |
|
70 | |||
71 | /** |
||
72 | * @return \AMQPChannel |
||
73 | */ |
||
74 | 16 | public function getResource() |
|
78 | |||
79 | /** |
||
80 | * @param \AMQPChannel $resource |
||
81 | * @return $this |
||
82 | */ |
||
83 | 16 | public function setResource(\AMQPChannel $resource) |
|
89 | |||
90 | /** |
||
91 | * Return internal channel ID |
||
92 | * |
||
93 | * @return integer |
||
94 | */ |
||
95 | 1 | public function getChannelId() |
|
99 | |||
100 | /** |
||
101 | * Set the window size and the number of messages to prefetch from the broker. |
||
102 | * |
||
103 | * @param int $prefetchSize The window size, in octets, to prefetch. |
||
104 | * @param int $prefetchCount The number of messages to prefetch. |
||
105 | * @return $this |
||
106 | * @throws \AMQPConnectionException |
||
107 | */ |
||
108 | 1 | public function setQos($prefetchSize, $prefetchCount) |
|
114 | |||
115 | /** |
||
116 | * Start a transaction. |
||
117 | * |
||
118 | * @return $this |
||
119 | * @throws \AMQPChannelException |
||
120 | * @throws \AMQPConnectionException |
||
121 | */ |
||
122 | 1 | public function startTransaction() |
|
128 | |||
129 | /** |
||
130 | * Commit a pending transaction. |
||
131 | * |
||
132 | * @return $this |
||
133 | * @throws \AMQPChannelException |
||
134 | * @throws \AMQPConnectionException |
||
135 | */ |
||
136 | 1 | public function commitTransaction() |
|
142 | |||
143 | /** |
||
144 | * Rollback a transaction. |
||
145 | * |
||
146 | * @return $this |
||
147 | * @throws \AMQPChannelException |
||
148 | * @throws \AMQPConnectionException |
||
149 | */ |
||
150 | 1 | public function rollbackTransaction() |
|
156 | |||
157 | /** |
||
158 | * Get the connection object in use |
||
159 | * |
||
160 | * @return Connection |
||
161 | */ |
||
162 | 1 | public function getConnection() |
|
166 | |||
167 | /** |
||
168 | * @param Connection $connection |
||
169 | * @return $this |
||
170 | */ |
||
171 | 8 | public function setConnection(Connection $connection) |
|
176 | |||
177 | /** |
||
178 | * Redeliver unacknowledged messages. |
||
179 | * |
||
180 | * @param bool $requeue |
||
181 | * @return $this |
||
182 | */ |
||
183 | 2 | public function basicRecover($requeue = true) |
|
189 | |||
190 | /** |
||
191 | * @param Options\QueueOptions|\Traversable|array $options |
||
192 | * @param \AMQPQueue $resource |
||
193 | * @return Queue |
||
194 | * @throws \AMQPConnectionException |
||
195 | * @throws \AMQPQueueException |
||
196 | * @throws Exception\BadMethodCallException |
||
197 | * @throws Exception\InvalidArgumentException |
||
198 | */ |
||
199 | 8 | public function createQueue($options, $resource = null) |
|
214 | |||
215 | /** |
||
216 | * @return \AMQPQueue |
||
217 | * @throws \AMQPConnectionException |
||
218 | * @throws \AMQPQueueException |
||
219 | * @codeCoverageIgnore |
||
220 | */ |
||
221 | protected function createQueueResource() |
||
225 | |||
226 | /** |
||
227 | * @param Options\ExchangeOptions|\Traversable|array $options |
||
228 | * @param \AMQPExchange $resource |
||
229 | * @return Exchange |
||
230 | * @throws \AMQPConnectionException |
||
231 | * @throws \AMQPExchangeException |
||
232 | * @throws Exception\BadMethodCallException |
||
233 | * @throws Exception\InvalidArgumentException |
||
234 | */ |
||
235 | 8 | public function createExchange($options, $resource = null) |
|
250 | |||
251 | /** |
||
252 | * @return \AMQPExchange |
||
253 | * @throws \AMQPConnectionException |
||
254 | * @throws \AMQPExchangeException |
||
255 | * @codeCoverageIgnore |
||
256 | */ |
||
257 | protected function createExchangeResource() |
||
261 | } |
||
262 |