1use crate::{
2 message::{BasicGetMessage, BasicReturnMessage},
3 options::*,
4 types::{Boolean, FieldTable, LongUInt, ShortUInt},
5 BasicProperties, ConfirmationFuture, Consumer, Error, ExchangeKind, Queue, Result,
6};
7use futures::Future;
8use lapin::{Channel as InnerChannel, Connection};
9
10#[derive(Clone)]
12#[deprecated(note = "use lapin instead")]
13pub struct Channel {
14 inner: InnerChannel,
15}
16
17impl Channel {
18 #[deprecated(note = "use lapin instead")]
20 pub fn create(conn: &Connection) -> impl Future<Item = Self, Error = Error> {
21 let confirmation: ConfirmationFuture<InnerChannel> = conn.create_channel().into();
22 confirmation.map(|inner| Channel { inner })
23 }
24
25 #[deprecated(note = "use lapin instead")]
26 pub fn id(&self) -> u16 {
27 self.inner.id()
28 }
29
30 #[deprecated(note = "use lapin instead")]
34 pub fn access_request(
35 &self,
36 realm: &str,
37 options: AccessRequestOptions,
38 ) -> ConfirmationFuture<()> {
39 self.inner.access_request(realm, options).into()
40 }
41
42 #[deprecated(note = "use lapin instead")]
46 pub fn exchange_declare(
47 &self,
48 name: &str,
49 exchange_type: ExchangeKind,
50 options: ExchangeDeclareOptions,
51 arguments: FieldTable,
52 ) -> ConfirmationFuture<()> {
53 self.inner
54 .exchange_declare(name, exchange_type, options, arguments)
55 .into()
56 }
57
58 #[deprecated(note = "use lapin instead")]
62 pub fn exchange_delete(
63 &self,
64 name: &str,
65 options: ExchangeDeleteOptions,
66 ) -> ConfirmationFuture<()> {
67 self.inner.exchange_delete(name, options).into()
68 }
69
70 #[deprecated(note = "use lapin instead")]
74 pub fn exchange_bind(
75 &self,
76 destination: &str,
77 source: &str,
78 routing_key: &str,
79 options: ExchangeBindOptions,
80 arguments: FieldTable,
81 ) -> ConfirmationFuture<()> {
82 self.inner
83 .exchange_bind(destination, source, routing_key, options, arguments)
84 .into()
85 }
86
87 #[deprecated(note = "use lapin instead")]
91 pub fn exchange_unbind(
92 &self,
93 destination: &str,
94 source: &str,
95 routing_key: &str,
96 options: ExchangeUnbindOptions,
97 arguments: FieldTable,
98 ) -> ConfirmationFuture<()> {
99 self.inner
100 .exchange_unbind(destination, source, routing_key, options, arguments)
101 .into()
102 }
103
104 #[deprecated(note = "use lapin instead")]
111 pub fn queue_declare(
112 &self,
113 name: &str,
114 options: QueueDeclareOptions,
115 arguments: FieldTable,
116 ) -> ConfirmationFuture<Queue> {
117 self.inner.queue_declare(name, options, arguments).into()
118 }
119
120 #[deprecated(note = "use lapin instead")]
124 pub fn queue_bind(
125 &self,
126 name: &str,
127 exchange: &str,
128 routing_key: &str,
129 options: QueueBindOptions,
130 arguments: FieldTable,
131 ) -> ConfirmationFuture<()> {
132 self.inner
133 .queue_bind(name, exchange, routing_key, options, arguments)
134 .into()
135 }
136
137 #[deprecated(note = "use lapin instead")]
141 pub fn queue_unbind(
142 &self,
143 name: &str,
144 exchange: &str,
145 routing_key: &str,
146 arguments: FieldTable,
147 ) -> ConfirmationFuture<()> {
148 self.inner
149 .queue_unbind(name, exchange, routing_key, arguments)
150 .into()
151 }
152
153 #[deprecated(note = "use lapin instead")]
155 pub fn confirm_select(&self, options: ConfirmSelectOptions) -> ConfirmationFuture<()> {
156 self.inner.confirm_select(options).into()
157 }
158
159 #[deprecated(note = "use lapin instead")]
161 pub fn basic_qos(
162 &self,
163 prefetch_count: ShortUInt,
164 options: BasicQosOptions,
165 ) -> ConfirmationFuture<()> {
166 self.inner.basic_qos(prefetch_count, options).into()
167 }
168
169 #[deprecated(note = "use lapin instead")]
171 pub fn basic_publish(
172 &self,
173 exchange: &str,
174 routing_key: &str,
175 payload: Vec<u8>,
176 options: BasicPublishOptions,
177 properties: BasicProperties,
178 ) -> ConfirmationFuture<()> {
179 self.inner
180 .basic_publish(exchange, routing_key, options, payload, properties)
181 .into()
182 }
183
184 #[deprecated(note = "use lapin instead")]
191 pub fn basic_consume(
192 &self,
193 queue: &str,
194 consumer_tag: &str,
195 options: BasicConsumeOptions,
196 arguments: FieldTable,
197 ) -> impl Future<Item = Consumer, Error = Error> {
198 let confirmation: ConfirmationFuture<lapin::Consumer> = self
199 .inner
200 .basic_consume(queue, consumer_tag, options, arguments)
201 .into();
202 confirmation.map(Consumer)
203 }
204
205 #[deprecated(note = "use lapin instead")]
206 pub fn basic_cancel(
207 &self,
208 consumer_tag: &str,
209 options: BasicCancelOptions,
210 ) -> ConfirmationFuture<()> {
211 self.inner.basic_cancel(consumer_tag, options).into()
212 }
213
214 #[deprecated(note = "use lapin instead")]
215 pub fn basic_recover(&self, options: BasicRecoverOptions) -> ConfirmationFuture<()> {
216 self.inner.basic_recover(options).into()
217 }
218
219 #[deprecated(note = "use lapin instead")]
220 pub fn basic_recover_async(&self, options: BasicRecoverAsyncOptions) -> ConfirmationFuture<()> {
221 self.inner.basic_recover_async(options).into()
222 }
223
224 #[deprecated(note = "use lapin instead")]
226 pub fn basic_ack(&self, delivery_tag: u64, multiple: bool) -> ConfirmationFuture<()> {
227 self.inner
228 .basic_ack(delivery_tag, BasicAckOptions { multiple })
229 .into()
230 }
231
232 #[deprecated(note = "use lapin instead")]
234 pub fn basic_nack(
235 &self,
236 delivery_tag: u64,
237 multiple: bool,
238 requeue: bool,
239 ) -> ConfirmationFuture<()> {
240 self.inner
241 .basic_nack(delivery_tag, BasicNackOptions { multiple, requeue })
242 .into()
243 }
244
245 #[deprecated(note = "use lapin instead")]
247 pub fn basic_reject(
248 &self,
249 delivery_tag: u64,
250 options: BasicRejectOptions,
251 ) -> ConfirmationFuture<()> {
252 self.inner.basic_reject(delivery_tag, options).into()
253 }
254
255 #[deprecated(note = "use lapin instead")]
257 pub fn basic_get(
258 &self,
259 queue: &str,
260 options: BasicGetOptions,
261 ) -> ConfirmationFuture<Option<BasicGetMessage>> {
262 self.inner.basic_get(queue, options).into()
263 }
264
265 #[deprecated(note = "use lapin instead")]
269 pub fn queue_purge(
270 &self,
271 queue_name: &str,
272 options: QueuePurgeOptions,
273 ) -> ConfirmationFuture<LongUInt> {
274 self.inner.queue_purge(queue_name, options).into()
275 }
276
277 #[deprecated(note = "use lapin instead")]
287 pub fn queue_delete(
288 &self,
289 queue_name: &str,
290 options: QueueDeleteOptions,
291 ) -> ConfirmationFuture<LongUInt> {
292 self.inner.queue_delete(queue_name, options).into()
293 }
294
295 #[deprecated(note = "use lapin instead")]
297 pub fn close(&self, code: u16, message: &str) -> ConfirmationFuture<()> {
298 self.inner.close(code, message).into()
299 }
300
301 #[deprecated(note = "use lapin instead")]
303 pub fn channel_flow(&self, options: ChannelFlowOptions) -> ConfirmationFuture<Boolean> {
304 self.inner.channel_flow(options).into()
305 }
306
307 #[deprecated(note = "use lapin instead")]
308 pub fn tx_select(&self) -> ConfirmationFuture<()> {
309 self.inner.tx_select().into()
310 }
311
312 #[deprecated(note = "use lapin instead")]
313 pub fn tx_commit(&self) -> ConfirmationFuture<()> {
314 self.inner.tx_commit().into()
315 }
316
317 #[deprecated(note = "use lapin instead")]
318 pub fn tx_rollback(&self) -> ConfirmationFuture<()> {
319 self.inner.tx_rollback().into()
320 }
321
322 #[deprecated(note = "use lapin instead")]
325 pub fn wait_for_confirms(&self) -> ConfirmationFuture<Vec<BasicReturnMessage>, Result<()>> {
326 self.inner.wait_for_confirms().into()
327 }
328}