1 | <?php |
||
18 | class Channel implements ChannelInterface |
||
19 | { |
||
20 | |||
21 | /** |
||
22 | * @var AMQPChannel |
||
23 | */ |
||
24 | protected $resource; |
||
25 | /** |
||
26 | * @var ConnectionInterface |
||
27 | */ |
||
28 | protected $connection; |
||
29 | /** |
||
30 | * @var Exchange |
||
31 | */ |
||
32 | protected $exchangePrototype; |
||
33 | /** |
||
34 | * @var Queue |
||
35 | */ |
||
36 | protected $queuePrototype; |
||
37 | |||
38 | /** |
||
39 | * Channel constructor. |
||
40 | * |
||
41 | * @param Exchange $exchangePrototype |
||
42 | * @param Queue $queuePrototype |
||
43 | */ |
||
44 | 20 | public function __construct(Exchange $exchangePrototype = null, Queue $queuePrototype = null) |
|
49 | |||
50 | /** |
||
51 | * @param Exchange $exchange |
||
52 | */ |
||
53 | 20 | public function registerExchange(Exchange $exchange) |
|
57 | |||
58 | /** |
||
59 | * @param Queue $queue |
||
60 | */ |
||
61 | 20 | public function registerQueue(Queue $queue) |
|
65 | |||
66 | /** |
||
67 | * Check the channel connection. |
||
68 | * |
||
69 | * @return bool Indicates whether the channel is connected. |
||
70 | */ |
||
71 | 1 | public function isConnected() |
|
75 | |||
76 | /** |
||
77 | * Get the connection object in use |
||
78 | * |
||
79 | * @return Connection |
||
80 | */ |
||
81 | 2 | public function getConnection() |
|
85 | |||
86 | /** |
||
87 | * @param Connection $connection |
||
88 | * @return $this |
||
89 | */ |
||
90 | 2 | public function setConnection(Connection $connection) |
|
95 | |||
96 | /** |
||
97 | * Return internal channel ID |
||
98 | * |
||
99 | * @return integer |
||
100 | */ |
||
101 | 1 | public function getChannelId() |
|
105 | |||
106 | /** |
||
107 | * @return AMQPChannel |
||
108 | */ |
||
109 | 8 | public function getResource() |
|
113 | |||
114 | /** |
||
115 | * @param AMQPChannel $resource |
||
116 | * @return $this |
||
117 | */ |
||
118 | 9 | public function setResource(AMQPChannel $resource) |
|
124 | |||
125 | /** |
||
126 | * Set the window size and the number of messages to prefetch from the broker. |
||
127 | * |
||
128 | * @param int $prefetchSize The window size, in octets, to prefetch. |
||
129 | * @param int $prefetchCount The number of messages to prefetch. |
||
130 | * @return $this |
||
131 | */ |
||
132 | 1 | public function setQos($prefetchSize, $prefetchCount) |
|
138 | |||
139 | /** |
||
140 | * Start a transaction. |
||
141 | * |
||
142 | * @return $this |
||
143 | */ |
||
144 | 1 | public function startTransaction() |
|
150 | |||
151 | /** |
||
152 | * Commit a pending transaction. |
||
153 | * |
||
154 | * @return $this |
||
155 | */ |
||
156 | 1 | public function commitTransaction() |
|
162 | |||
163 | /** |
||
164 | * Rollback a transaction. |
||
165 | * |
||
166 | * @return $this |
||
167 | */ |
||
168 | 1 | public function rollbackTransaction() |
|
174 | |||
175 | /** |
||
176 | * Redeliver unacknowledged messages. |
||
177 | * |
||
178 | * @param bool $requeue |
||
179 | * @return $this |
||
180 | */ |
||
181 | 2 | public function basicRecover($requeue = true) |
|
187 | |||
188 | /** |
||
189 | * Create a new queue |
||
190 | * |
||
191 | * @param Options\QueueOptions|\Traversable|array $options |
||
192 | * @return QueueInterface |
||
193 | * @throws Exception\BadMethodCallException |
||
194 | * @throws Exception\InvalidArgumentException |
||
195 | */ |
||
196 | 1 | public function createQueue($options) |
|
209 | |||
210 | /** |
||
211 | * Create a new exchange |
||
212 | * |
||
213 | * @param Options\ExchangeOptions|\Traversable|array $options |
||
214 | * @return ExchangeInterface |
||
215 | * @throws Exception\BadMethodCallException |
||
216 | * @throws Exception\InvalidArgumentException |
||
217 | */ |
||
218 | 1 | public function createExchange($options) |
|
231 | } |
||
232 |