2
2
AMQP Adapter
3
3
4
4
"""
5
- from pamqp import specification as spec
6
-
5
+ from pamqp import commands
7
6
from rabbitpy import base
8
7
from rabbitpy import message
9
8
from rabbitpy import exceptions
@@ -35,7 +34,7 @@ def basic_ack(self, delivery_tag=0, multiple=False):
35
34
:param bool multiple: Acknowledge multiple messages
36
35
37
36
"""
38
- self ._write_frame (spec .Basic .Ack (delivery_tag , multiple ))
37
+ self ._write_frame (commands .Basic .Ack (delivery_tag , multiple ))
39
38
40
39
def basic_consume (self , queue = '' , consumer_tag = '' , no_local = False ,
41
40
no_ack = False , exclusive = False , nowait = False ,
@@ -70,7 +69,7 @@ def basic_consume(self, queue='', consumer_tag='', no_local=False,
70
69
consumer_tag = self .consumer_tag
71
70
# pylint: disable=protected-access
72
71
self .channel ._consumers [consumer_tag ] = (self , no_ack )
73
- self ._rpc (spec .Basic .Consume (0 , queue , consumer_tag , no_local , no_ack ,
72
+ self ._rpc (commands .Basic .Consume (0 , queue , consumer_tag , no_local , no_ack ,
74
73
exclusive , nowait , arguments ))
75
74
self ._consuming = True
76
75
try :
@@ -119,7 +118,7 @@ def basic_get(self, queue='', no_ack=False):
119
118
:param bool no_ack: No acknowledgement needed
120
119
121
120
"""
122
- self ._rpc (spec .Basic .Get (0 , queue , no_ack ))
121
+ self ._rpc (commands .Basic .Get (0 , queue , no_ack ))
123
122
124
123
def basic_nack (self , delivery_tag = 0 , multiple = False , requeue = True ):
125
124
"""Reject one or more incoming messages.
@@ -137,7 +136,7 @@ def basic_nack(self, delivery_tag=0, multiple=False, requeue=True):
137
136
:param bool requeue: Requeue the message
138
137
139
138
"""
140
- self ._write_frame (spec .Basic .Nack (delivery_tag , multiple , requeue ))
139
+ self ._write_frame (commands .Basic .Nack (delivery_tag , multiple , requeue ))
141
140
142
141
def basic_publish (self , exchange = '' , routing_key = '' , body = '' ,
143
142
properties = None , mandatory = False , immediate = False ):
@@ -178,7 +177,7 @@ def basic_qos(self, prefetch_size=0, prefetch_count=0, global_flag=False):
178
177
:param bool global_flag: Apply to entire connection
179
178
180
179
"""
181
- self ._rpc (spec .Basic .Qos (prefetch_size , prefetch_count , global_flag ))
180
+ self ._rpc (commands .Basic .Qos (prefetch_size , prefetch_count , global_flag ))
182
181
183
182
def basic_reject (self , delivery_tag = 0 , requeue = True ):
184
183
"""Reject an incoming message
@@ -192,7 +191,7 @@ def basic_reject(self, delivery_tag=0, requeue=True):
192
191
:param bool requeue: Requeue the message
193
192
194
193
"""
195
- self ._write_frame (spec .Basic .Reject (delivery_tag , requeue ))
194
+ self ._write_frame (commands .Basic .Reject (delivery_tag , requeue ))
196
195
197
196
def basic_recover (self , requeue = False ):
198
197
"""Redeliver unacknowledged messages
@@ -204,14 +203,14 @@ def basic_recover(self, requeue=False):
204
203
:param bool requeue: Requeue the message
205
204
206
205
"""
207
- self ._rpc (spec .Basic .Recover (requeue ))
206
+ self ._rpc (commands .Basic .Recover (requeue ))
208
207
209
208
def confirm_select (self ):
210
209
"""This method sets the channel to use publisher acknowledgements. The
211
210
client can only use this method on a non-transactional channel.
212
211
213
212
"""
214
- self ._rpc (spec .Confirm .Select ())
213
+ self ._rpc (commands .Confirm .Select ())
215
214
216
215
def exchange_declare (self , exchange = '' , exchange_type = 'direct' ,
217
216
passive = False , durable = False , auto_delete = False ,
@@ -232,7 +231,7 @@ def exchange_declare(self, exchange='', exchange_type='direct',
232
231
:param dict arguments: Arguments for declaration
233
232
234
233
"""
235
- self ._rpc (spec .Exchange .Declare (0 , exchange , exchange_type , passive ,
234
+ self ._rpc (commands .Exchange .Declare (0 , exchange , exchange_type , passive ,
236
235
durable , auto_delete , internal , nowait ,
237
236
arguments ))
238
237
@@ -248,7 +247,7 @@ def exchange_delete(self, exchange='', if_unused=False,
248
247
:param bool nowait: Do not send a reply method
249
248
250
249
"""
251
- self ._rpc (spec .Exchange .Delete (0 , exchange , if_unused , nowait ))
250
+ self ._rpc (commands .Exchange .Delete (0 , exchange , if_unused , nowait ))
252
251
253
252
def exchange_bind (self , destination = '' , source = '' ,
254
253
routing_key = '' , nowait = False , arguments = None ):
@@ -263,7 +262,7 @@ def exchange_bind(self, destination='', source='',
263
262
:param dict arguments: Optional arguments
264
263
265
264
"""
266
- self ._rpc (spec .Exchange .Bind (0 , destination , source , routing_key ,
265
+ self ._rpc (commands .Exchange .Bind (0 , destination , source , routing_key ,
267
266
nowait , arguments ))
268
267
269
268
def exchange_unbind (self , destination = '' , source = '' ,
@@ -279,7 +278,7 @@ def exchange_unbind(self, destination='', source='',
279
278
:param dict arguments: Optional arguments
280
279
281
280
"""
282
- self ._rpc (spec .Exchange .Unbind (0 , destination , source , routing_key ,
281
+ self ._rpc (commands .Exchange .Unbind (0 , destination , source , routing_key ,
283
282
nowait , arguments ))
284
283
285
284
def queue_bind (self , queue = '' , exchange = '' , routing_key = '' ,
@@ -298,7 +297,7 @@ def queue_bind(self, queue='', exchange='', routing_key='',
298
297
:param dict arguments: Arguments for binding
299
298
300
299
"""
301
- self ._rpc (spec .Queue .Bind (0 , queue , exchange , routing_key , nowait ,
300
+ self ._rpc (commands .Queue .Bind (0 , queue , exchange , routing_key , nowait ,
302
301
arguments ))
303
302
304
303
def queue_declare (self , queue = '' , passive = False , durable = False ,
@@ -319,7 +318,7 @@ def queue_declare(self, queue='', passive=False, durable=False,
319
318
:param dict arguments: Arguments for declaration
320
319
321
320
"""
322
- self ._rpc (spec .Queue .Declare (0 , queue , passive , durable , exclusive ,
321
+ self ._rpc (commands .Queue .Declare (0 , queue , passive , durable , exclusive ,
323
322
auto_delete , nowait , arguments ))
324
323
325
324
def queue_delete (self , queue = '' , if_unused = False , if_empty = False ,
@@ -336,7 +335,7 @@ def queue_delete(self, queue='', if_unused=False, if_empty=False,
336
335
:param bool nowait: Do not send a reply method
337
336
338
337
"""
339
- self ._rpc (spec .Queue .Delete (0 , queue , if_unused , if_empty , nowait ))
338
+ self ._rpc (commands .Queue .Delete (0 , queue , if_unused , if_empty , nowait ))
340
339
341
340
def queue_purge (self , queue = '' , nowait = False ):
342
341
"""Purge a queue
@@ -348,7 +347,7 @@ def queue_purge(self, queue='', nowait=False):
348
347
:param bool nowait: Do not send a reply method
349
348
350
349
"""
351
- self ._rpc (spec .Queue .Purge (0 , queue , nowait ))
350
+ self ._rpc (commands .Queue .Purge (0 , queue , nowait ))
352
351
353
352
def queue_unbind (self , queue = '' , exchange = '' , routing_key = '' ,
354
353
arguments = None ):
@@ -362,7 +361,7 @@ def queue_unbind(self, queue='', exchange='', routing_key='',
362
361
:param dict arguments: Arguments of binding
363
362
364
363
"""
365
- self ._rpc (spec .Queue .Unbind (0 , queue , exchange , routing_key ,
364
+ self ._rpc (commands .Queue .Unbind (0 , queue , exchange , routing_key ,
366
365
arguments ))
367
366
368
367
def tx_select (self ):
@@ -373,7 +372,7 @@ def tx_select(self):
373
372
or Rollback methods.
374
373
375
374
"""
376
- self ._rpc (spec .Tx .Select ())
375
+ self ._rpc (commands .Tx .Select ())
377
376
378
377
def tx_commit (self ):
379
378
"""Commit the current transaction
@@ -383,7 +382,7 @@ def tx_commit(self):
383
382
immediately after a commit.
384
383
385
384
"""
386
- self ._rpc (spec .Tx .Commit ())
385
+ self ._rpc (commands .Tx .Commit ())
387
386
388
387
def tx_rollback (self ):
389
388
"""Abandon the current transaction
@@ -395,4 +394,4 @@ def tx_rollback(self):
395
394
recover call should be issued.
396
395
397
396
"""
398
- self ._rpc (spec .Tx .Rollback ())
397
+ self ._rpc (commands .Tx .Rollback ())
0 commit comments