amq-client 0.7.0.alpha25 → 0.7.0.alpha26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,8 +41,8 @@ module AMQ
41
41
  attr_accessor :flow_is_active
42
42
 
43
43
 
44
- def initialize(client, id)
45
- super(client)
44
+ def initialize(connection, id)
45
+ super(connection)
46
46
 
47
47
  @id = id
48
48
  @exchanges = Hash.new
@@ -54,8 +54,8 @@ module AMQ
54
54
  # 65536 is here for cases when channel is opened without passing a callback in,
55
55
  # otherwise channel_mix would be nil and it causes a lot of needless headaches.
56
56
  # lets just have this default. MK.
57
- channel_max = if client.connection
58
- client.connection.channel_max || 65536
57
+ channel_max = if @connection.open?
58
+ @connection.channel_max || 65536
59
59
  else
60
60
  65536
61
61
  end
@@ -84,27 +84,27 @@ module AMQ
84
84
  #
85
85
  # @return [AMQ::Client::Connection] Connection this channel belongs to.
86
86
  def connection
87
- @client.connection
87
+ @connection
88
88
  end # connection
89
89
 
90
90
  # Opens AMQP channel.
91
91
  #
92
92
  # @api public
93
93
  def open(&block)
94
- @client.send Protocol::Channel::Open.encode(@id, AMQ::Protocol::EMPTY_STRING)
95
- @client.connection.channels[@id] = self
94
+ @connection.send Protocol::Channel::Open.encode(@id, AMQ::Protocol::EMPTY_STRING)
95
+ @connection.channels[@id] = self
96
96
  self.status = :opening
97
97
 
98
- self.define_callback :open, &block
98
+ self.redefine_callback :open, &block
99
99
  end
100
100
 
101
101
  # Closes AMQP channel.
102
102
  #
103
103
  # @api public
104
104
  def close(reply_code = 200, reply_text = DEFAULT_REPLY_TEXT, class_id = 0, method_id = 0, &block)
105
- @client.send Protocol::Channel::Close.encode(@id, reply_code, reply_text, class_id, method_id)
105
+ @connection.send Protocol::Channel::Close.encode(@id, reply_code, reply_text, class_id, method_id)
106
106
 
107
- self.define_callback :close, &block
107
+ self.redefine_callback :close, &block
108
108
  end
109
109
 
110
110
 
@@ -113,7 +113,7 @@ module AMQ
113
113
  # @api public
114
114
  # @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.8.3.13.)
115
115
  def acknowledge(delivery_tag, multiple = false)
116
- @client.send(Protocol::Basic::Ack.encode(self.id, delivery_tag, multiple))
116
+ @connection.send(Protocol::Basic::Ack.encode(self.id, delivery_tag, multiple))
117
117
 
118
118
  self
119
119
  end # acknowledge(delivery_tag, multiple = false)
@@ -123,7 +123,7 @@ module AMQ
123
123
  # @api public
124
124
  # @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.8.3.14.)
125
125
  def reject(delivery_tag, requeue = true)
126
- @client.send(Protocol::Basic::Reject.encode(self.id, delivery_tag, requeue))
126
+ @connection.send(Protocol::Basic::Reject.encode(self.id, delivery_tag, requeue))
127
127
 
128
128
  self
129
129
  end # reject(delivery_tag, requeue = true)
@@ -134,7 +134,7 @@ module AMQ
134
134
  # @note RabbitMQ as of 2.3.1 does not support prefetch_size.
135
135
  # @api public
136
136
  def qos(prefetch_size = 0, prefetch_count = 32, global = false, &block)
137
- @client.send Protocol::Basic::Qos.encode(@id, prefetch_size, prefetch_count, global)
137
+ @connection.send Protocol::Basic::Qos.encode(@id, prefetch_size, prefetch_count, global)
138
138
 
139
139
  self.redefine_callback :qos, &block
140
140
  self
@@ -149,7 +149,7 @@ module AMQ
149
149
  # @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.8.3.16.)
150
150
  # @api public
151
151
  def recover(requeue = true, &block)
152
- @client.send(Protocol::Basic::Recover.encode(@id, requeue))
152
+ @connection.send(Protocol::Basic::Recover.encode(@id, requeue))
153
153
 
154
154
  self.redefine_callback :recover, &block
155
155
  self
@@ -166,7 +166,7 @@ module AMQ
166
166
  # @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.5.2.3.)
167
167
  # @api public
168
168
  def flow(active = false, &block)
169
- @client.send Protocol::Channel::Flow.encode(@id, active)
169
+ @connection.send Protocol::Channel::Flow.encode(@id, active)
170
170
 
171
171
  self.redefine_callback :flow, &block
172
172
  self
@@ -178,7 +178,7 @@ module AMQ
178
178
  #
179
179
  # @api public
180
180
  def tx_select(&block)
181
- @client.send Protocol::Tx::Select.encode(@id)
181
+ @connection.send Protocol::Tx::Select.encode(@id)
182
182
 
183
183
  self.redefine_callback :tx_select, &block
184
184
  self
@@ -188,7 +188,7 @@ module AMQ
188
188
  #
189
189
  # @api public
190
190
  def tx_commit(&block)
191
- @client.send Protocol::Tx::Commit.encode(@id)
191
+ @connection.send Protocol::Tx::Commit.encode(@id)
192
192
 
193
193
  self.redefine_callback :tx_commit, &block
194
194
  self
@@ -198,7 +198,7 @@ module AMQ
198
198
  #
199
199
  # @api public
200
200
  def tx_rollback(&block)
201
- @client.send Protocol::Tx::Rollback.encode(@id)
201
+ @connection.send Protocol::Tx::Rollback.encode(@id)
202
202
 
203
203
  self.redefine_callback :tx_rollback, &block
204
204
  self
@@ -270,78 +270,77 @@ module AMQ
270
270
 
271
271
 
272
272
 
273
- def handle_open_ok(method)
273
+ def handle_open_ok(open_ok)
274
274
  self.status = :opened
275
- self.exec_callback_once_yielding_self(:open, method)
275
+ self.exec_callback_once_yielding_self(:open, open_ok)
276
276
  end
277
277
 
278
- def handle_close_ok(method)
278
+ def handle_close_ok(close_ok)
279
279
  self.status = :closed
280
- self.exec_callback_once_yielding_self(:close, method)
280
+ self.exec_callback_once_yielding_self(:close, close_ok)
281
281
  end
282
282
 
283
- def handle_close(method)
283
+ def handle_close(channel_close)
284
284
  self.status = :closed
285
- self.exec_callback_yielding_self(:error, method)
285
+ self.exec_callback_yielding_self(:error, channel_close)
286
286
 
287
- self.handle_connection_interruption(method)
287
+ self.handle_connection_interruption(channel_close)
288
288
  end
289
289
 
290
- # === Handlers ===
291
290
 
292
- self.handle(Protocol::Channel::OpenOk) do |client, frame|
293
- channel = client.connection.channels[frame.channel]
291
+
292
+ self.handle(Protocol::Channel::OpenOk) do |connection, frame|
293
+ channel = connection.channels[frame.channel]
294
294
  channel.handle_open_ok(frame.decode_payload)
295
295
  end
296
296
 
297
- self.handle(Protocol::Channel::CloseOk) do |client, frame|
297
+ self.handle(Protocol::Channel::CloseOk) do |connection, frame|
298
298
  method = frame.decode_payload
299
- channels = client.connection.channels
299
+ channels = connection.channels
300
300
 
301
301
  channel = channels[frame.channel]
302
302
  channels.delete(channel)
303
-
304
303
  channel.handle_close_ok(method)
305
304
  end
306
305
 
307
- self.handle(Protocol::Channel::Close) do |client, frame|
306
+ self.handle(Protocol::Channel::Close) do |connection, frame|
308
307
  method = frame.decode_payload
309
- channels = client.connection.channels
308
+ channels = connection.channels
310
309
  channel = channels[frame.channel]
311
310
 
312
311
  channel.handle_close(method)
313
312
  end
314
313
 
315
- self.handle(Protocol::Basic::QosOk) do |client, frame|
316
- channel = client.connection.channels[frame.channel]
314
+ self.handle(Protocol::Basic::QosOk) do |connection, frame|
315
+ channel = connection.channels[frame.channel]
317
316
  channel.exec_callback(:qos, frame.decode_payload)
318
317
  end
319
318
 
320
- self.handle(Protocol::Basic::RecoverOk) do |client, frame|
321
- channel = client.connection.channels[frame.channel]
319
+ self.handle(Protocol::Basic::RecoverOk) do |connection, frame|
320
+ channel = connection.channels[frame.channel]
322
321
  channel.exec_callback(:recover, frame.decode_payload)
323
322
  end
324
323
 
325
- self.handle(Protocol::Channel::FlowOk) do |client, frame|
326
- channel = client.connection.channels[frame.channel]
324
+ self.handle(Protocol::Channel::FlowOk) do |connection, frame|
325
+ channel = connection.channels[frame.channel]
327
326
  method = frame.decode_payload
328
327
 
329
328
  channel.flow_is_active = method.active
330
329
  channel.exec_callback(:flow, method)
331
330
  end
332
331
 
333
- self.handle(Protocol::Tx::SelectOk) do |client, frame|
334
- channel = client.connection.channels[frame.channel]
332
+ self.handle(Protocol::Tx::SelectOk) do |connection, frame|
333
+ channel = connection.channels[frame.channel]
335
334
  channel.exec_callback(:tx_select, frame.decode_payload)
336
335
  end
337
336
 
338
- self.handle(Protocol::Tx::CommitOk) do |client, frame|
339
- channel = client.connection.channels[frame.channel]
337
+ self.handle(Protocol::Tx::CommitOk) do |connection, frame|
338
+ channel = connection.channels[frame.channel]
340
339
  channel.exec_callback(:tx_commit, frame.decode_payload)
341
340
  end
342
341
 
343
- self.handle(Protocol::Tx::RollbackOk) do |client, frame|
344
- channel = client.connection.channels[frame.channel]
342
+ self.handle(Protocol::Tx::RollbackOk) do |connection, frame|
343
+ channel = connection.channels[frame.channel]
345
344
  channel.exec_callback(:tx_rollback, frame.decode_payload)
346
345
  end
347
346
  end # Channel
@@ -53,11 +53,11 @@ module AMQ
53
53
  attr_reader :callbacks
54
54
 
55
55
 
56
- def initialize(client)
57
- @client = client
56
+ def initialize(connection)
57
+ @connection = connection
58
58
  # Be careful with default values for #ruby hashes: h = Hash.new(Array.new); h[:key] ||= 1
59
59
  # won't assign anything to :key. MK.
60
- @callbacks = Hash.new
60
+ @callbacks = Hash.new
61
61
  end
62
62
 
63
63
 
@@ -65,7 +65,7 @@ module AMQ
65
65
  # Asynchronous error handling.
66
66
  # Set callback for given class (Queue for example)
67
67
  # or for the Connection class (or instance, of course).
68
- callbacks = [self.callbacks[:close], self.client.connection.callbacks[:close]].flatten.compact
68
+ callbacks = [self.callbacks[:close], self.connection.callbacks[:close]].flatten.compact
69
69
 
70
70
  callbacks.map { |c| c.call(exception) } if callbacks.any?
71
71
  end
@@ -34,12 +34,12 @@ module AMQ
34
34
  # @return [Symbol] One of :direct, :fanout, :topic, :headers
35
35
  attr_reader :type
36
36
 
37
- def initialize(client, channel, name, type = :fanout)
37
+ def initialize(connection, channel, name, type = :fanout)
38
38
  if !(TYPES.include?(type.to_sym) || type.to_s =~ /^x-.+/i)
39
39
  raise IncompatibleExchangeTypeError.new(TYPES, type)
40
40
  end
41
41
 
42
- @client = client
42
+ @connection = connection
43
43
  @channel = channel
44
44
  @name = name
45
45
  @type = type
@@ -49,7 +49,7 @@ module AMQ
49
49
  @channel.register_exchange(self)
50
50
  end
51
51
 
52
- super(client)
52
+ super(connection)
53
53
  end
54
54
 
55
55
 
@@ -68,7 +68,7 @@ module AMQ
68
68
 
69
69
 
70
70
  def declare(passive = false, durable = false, auto_delete = false, nowait = false, arguments = nil, &block)
71
- @client.send(Protocol::Exchange::Declare.encode(@channel.id, @name, @type.to_s, passive, durable, auto_delete, false, nowait, arguments))
71
+ @connection.send(Protocol::Exchange::Declare.encode(@channel.id, @name, @type.to_s, passive, durable, auto_delete, false, nowait, arguments))
72
72
 
73
73
  unless nowait
74
74
  self.define_callback(:declare, &block)
@@ -80,7 +80,7 @@ module AMQ
80
80
 
81
81
 
82
82
  def delete(if_unused = false, nowait = false, &block)
83
- @client.send(Protocol::Exchange::Delete.encode(@channel.id, @name, if_unused, nowait))
83
+ @connection.send(Protocol::Exchange::Delete.encode(@channel.id, @name, if_unused, nowait))
84
84
 
85
85
  unless nowait
86
86
  self.define_callback(:delete, &block)
@@ -95,7 +95,7 @@ module AMQ
95
95
 
96
96
  def publish(payload, routing_key = AMQ::Protocol::EMPTY_STRING, user_headers = {}, mandatory = false, immediate = false, frame_size = nil, &block)
97
97
  headers = { :priority => 0, :delivery_mode => 2, :content_type => "application/octet-stream" }.merge(user_headers)
98
- @client.send_frameset(Protocol::Basic::Publish.encode(@channel.id, payload, headers, @name, routing_key, mandatory, immediate, (frame_size || @client.connection.frame_max)))
98
+ @connection.send_frameset(Protocol::Basic::Publish.encode(@channel.id, payload, headers, @name, routing_key, mandatory, immediate, (frame_size || @connection.frame_max)))
99
99
 
100
100
  block.call if block
101
101
 
@@ -125,32 +125,24 @@ module AMQ
125
125
 
126
126
 
127
127
 
128
- # === Handlers ===
129
- # Get the first exchange which didn't receive Exchange.Declare-Ok yet and run its declare callback.
130
- # The cache includes only exchanges with {nowait: false}.
131
- self.handle(Protocol::Exchange::DeclareOk) do |client, frame|
132
- method = frame.decode_payload
133
-
134
- # We should have cache API, so it'll be easy to change caching behaviour easily.
135
- # So in the amq-client we don't want to cache more than just the last instance per each channel,
136
- # whereas more opinionated clients might want to have every single instance in the cache,
137
- # so they can iterate over it etc.
138
- channel = client.connection.channels[frame.channel]
128
+ self.handle(Protocol::Exchange::DeclareOk) do |connection, frame|
129
+ method = frame.decode_payload
130
+ channel = connection.channels[frame.channel]
139
131
  exchange = channel.exchanges_awaiting_declare_ok.shift
140
132
 
141
133
  exchange.handle_declare_ok(method)
142
134
  end # handle
143
135
 
144
136
 
145
- self.handle(Protocol::Exchange::DeleteOk) do |client, frame|
146
- channel = client.connection.channels[frame.channel]
137
+ self.handle(Protocol::Exchange::DeleteOk) do |connection, frame|
138
+ channel = connection.channels[frame.channel]
147
139
  exchange = channel.exchanges_awaiting_delete_ok.shift
148
140
  exchange.handle_delete_ok(frame.decode_payload)
149
141
  end # handle
150
142
 
151
143
 
152
- self.handle(Protocol::Basic::Return) do |client, frame, content_frames|
153
- channel = client.connection.channels[frame.channel]
144
+ self.handle(Protocol::Basic::Return) do |connection, frame, content_frames|
145
+ channel = connection.channels[frame.channel]
154
146
  method = frame.decode_payload
155
147
  exchange = channel.find_exchange(method.exchange)
156
148
 
@@ -15,7 +15,7 @@ module AMQ
15
15
 
16
16
  include Entity
17
17
  include ServerNamedEntity
18
- extend ProtocolMethodHandlers
18
+ extend ProtocolMethodHandlers
19
19
 
20
20
 
21
21
  #
@@ -35,8 +35,8 @@ module AMQ
35
35
  # @param [AMQ::Client::Channel] AMQ channel this queue object uses.
36
36
  # @param [String] Queue name. Please note that AMQP spec does not require brokers to support Unicode for queue names.
37
37
  # @api public
38
- def initialize(client, channel, name = AMQ::Protocol::EMPTY_STRING)
39
- super(client)
38
+ def initialize(connection, channel, name = AMQ::Protocol::EMPTY_STRING)
39
+ super(connection)
40
40
 
41
41
  @name = name
42
42
  @channel = channel
@@ -87,7 +87,7 @@ module AMQ
87
87
  @auto_delete = auto_delete
88
88
 
89
89
  nowait = true if !block && !@name.empty?
90
- @client.send(Protocol::Queue::Declare.encode(@channel.id, @name, passive, durable, exclusive, auto_delete, nowait, arguments))
90
+ @connection.send(Protocol::Queue::Declare.encode(@channel.id, @name, passive, durable, exclusive, auto_delete, nowait, arguments))
91
91
 
92
92
  if !nowait
93
93
  self.append_callback(:declare, &block)
@@ -108,7 +108,7 @@ module AMQ
108
108
  # @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.7.2.9.)
109
109
  def delete(if_unused = false, if_empty = false, nowait = false, &block)
110
110
  nowait = true unless block
111
- @client.send(Protocol::Queue::Delete.encode(@channel.id, @name, if_unused, if_empty, nowait))
111
+ @connection.send(Protocol::Queue::Delete.encode(@channel.id, @name, if_unused, if_empty, nowait))
112
112
 
113
113
  if !nowait
114
114
  self.append_callback(:delete, &block)
@@ -134,7 +134,7 @@ module AMQ
134
134
  exchange
135
135
  end
136
136
 
137
- @client.send(Protocol::Queue::Bind.encode(@channel.id, @name, exchange_name, routing_key, nowait, arguments))
137
+ @connection.send(Protocol::Queue::Bind.encode(@channel.id, @name, exchange_name, routing_key, nowait, arguments))
138
138
 
139
139
  if !nowait
140
140
  self.append_callback(:bind, &block)
@@ -159,7 +159,7 @@ module AMQ
159
159
  exchange
160
160
  end
161
161
 
162
- @client.send(Protocol::Queue::Unbind.encode(@channel.id, @name, exchange_name, routing_key, arguments))
162
+ @connection.send(Protocol::Queue::Unbind.encode(@channel.id, @name, exchange_name, routing_key, arguments))
163
163
 
164
164
  self.append_callback(:unbind, &block)
165
165
  # TODO: handle channel & connection-level exceptions
@@ -179,7 +179,7 @@ module AMQ
179
179
 
180
180
  nowait = true unless block
181
181
  @consumer_tag = generate_consumer_tag(name)
182
- @client.send(Protocol::Basic::Consume.encode(@channel.id, @name, @consumer_tag, no_local, no_ack, exclusive, nowait, arguments))
182
+ @connection.send(Protocol::Basic::Consume.encode(@channel.id, @name, @consumer_tag, no_local, no_ack, exclusive, nowait, arguments))
183
183
 
184
184
  @channel.consumers[@consumer_tag] = self
185
185
 
@@ -220,7 +220,7 @@ module AMQ
220
220
  # @api public
221
221
  # @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.8.3.10.)
222
222
  def get(no_ack = false, &block)
223
- @client.send(Protocol::Basic::Get.encode(@channel.id, @name, no_ack))
223
+ @connection.send(Protocol::Basic::Get.encode(@channel.id, @name, no_ack))
224
224
 
225
225
  # most people only want one callback per #get call. Consider the following example:
226
226
  #
@@ -241,7 +241,7 @@ module AMQ
241
241
  def cancel(nowait = false, &block)
242
242
  raise "There is no consumer tag for this queue. This usually means that you are trying to unsubscribe a queue that never was subscribed for messages in the first place." if @consumer_tag.nil?
243
243
 
244
- @client.send(Protocol::Basic::Cancel.encode(@channel.id, @consumer_tag, nowait))
244
+ @connection.send(Protocol::Basic::Cancel.encode(@channel.id, @consumer_tag, nowait))
245
245
  @consumer_tag = nil
246
246
  self.clear_callbacks(:delivery)
247
247
  self.clear_callbacks(:consume)
@@ -261,7 +261,7 @@ module AMQ
261
261
  # @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.7.2.7.)
262
262
  def purge(nowait = false, &block)
263
263
  nowait = true unless block
264
- @client.send(Protocol::Queue::Purge.encode(@channel.id, @name, nowait))
264
+ @connection.send(Protocol::Queue::Purge.encode(@channel.id, @name, nowait))
265
265
 
266
266
  if !nowait
267
267
  self.redefine_callback(:purge, &block)
@@ -358,49 +358,49 @@ module AMQ
358
358
 
359
359
  # Get the first queue which didn't receive Queue.Declare-Ok yet and run its declare callback.
360
360
  # The cache includes only queues with {nowait: false}.
361
- self.handle(Protocol::Queue::DeclareOk) do |client, frame|
361
+ self.handle(Protocol::Queue::DeclareOk) do |connection, frame|
362
362
  method = frame.decode_payload
363
363
 
364
- channel = client.connection.channels[frame.channel]
364
+ channel = connection.channels[frame.channel]
365
365
  queue = channel.queues_awaiting_declare_ok.shift
366
366
 
367
367
  queue.handle_declare_ok(method)
368
368
  end
369
369
 
370
370
 
371
- self.handle(Protocol::Queue::DeleteOk) do |client, frame|
372
- channel = client.connection.channels[frame.channel]
371
+ self.handle(Protocol::Queue::DeleteOk) do |connection, frame|
372
+ channel = connection.channels[frame.channel]
373
373
  queue = channel.queues_awaiting_delete_ok.shift
374
374
  queue.handle_delete_ok(frame.decode_payload)
375
375
  end
376
376
 
377
377
 
378
- self.handle(Protocol::Queue::BindOk) do |client, frame|
379
- channel = client.connection.channels[frame.channel]
378
+ self.handle(Protocol::Queue::BindOk) do |connection, frame|
379
+ channel = connection.channels[frame.channel]
380
380
  queue = channel.queues_awaiting_bind_ok.shift
381
381
 
382
382
  queue.handle_bind_ok(frame.decode_payload)
383
383
  end
384
384
 
385
385
 
386
- self.handle(Protocol::Queue::UnbindOk) do |client, frame|
387
- channel = client.connection.channels[frame.channel]
386
+ self.handle(Protocol::Queue::UnbindOk) do |connection, frame|
387
+ channel = connection.channels[frame.channel]
388
388
  queue = channel.queues_awaiting_unbind_ok.shift
389
389
 
390
390
  queue.handle_unbind_ok(frame.decode_payload)
391
391
  end
392
392
 
393
393
 
394
- self.handle(Protocol::Basic::ConsumeOk) do |client, frame|
395
- channel = client.connection.channels[frame.channel]
394
+ self.handle(Protocol::Basic::ConsumeOk) do |connection, frame|
395
+ channel = connection.channels[frame.channel]
396
396
  queue = channel.queues_awaiting_consume_ok.shift
397
397
 
398
398
  queue.handle_consume_ok(frame.decode_payload)
399
399
  end
400
400
 
401
401
 
402
- self.handle(Protocol::Basic::CancelOk) do |client, frame|
403
- channel = client.connection.channels[frame.channel]
402
+ self.handle(Protocol::Basic::CancelOk) do |connection, frame|
403
+ channel = connection.channels[frame.channel]
404
404
  queue = channel.queues_awaiting_cancel_ok.shift
405
405
 
406
406
  queue.handle_consume_ok(frame.decode_payload)
@@ -408,8 +408,8 @@ module AMQ
408
408
 
409
409
 
410
410
  # Basic.Deliver
411
- self.handle(Protocol::Basic::Deliver) do |client, method_frame, content_frames|
412
- channel = client.connection.channels[method_frame.channel]
411
+ self.handle(Protocol::Basic::Deliver) do |connection, method_frame, content_frames|
412
+ channel = connection.channels[method_frame.channel]
413
413
  method = method_frame.decode_payload
414
414
  queue = channel.consumers[method.consumer_tag]
415
415
 
@@ -420,16 +420,16 @@ module AMQ
420
420
  end
421
421
 
422
422
 
423
- self.handle(Protocol::Queue::PurgeOk) do |client, frame|
424
- channel = client.connection.channels[frame.channel]
423
+ self.handle(Protocol::Queue::PurgeOk) do |connection, frame|
424
+ channel = connection.channels[frame.channel]
425
425
  queue = channel.queues_awaiting_purge_ok.shift
426
426
 
427
427
  queue.handle_purge_ok(frame.decode_payload)
428
428
  end
429
429
 
430
430
 
431
- self.handle(Protocol::Basic::GetOk) do |client, frame, content_frames|
432
- channel = client.connection.channels[frame.channel]
431
+ self.handle(Protocol::Basic::GetOk) do |connection, frame, content_frames|
432
+ channel = connection.channels[frame.channel]
433
433
  queue = channel.queues_awaiting_get_response.shift
434
434
  method = frame.decode_payload
435
435
 
@@ -440,8 +440,8 @@ module AMQ
440
440
  end
441
441
 
442
442
 
443
- self.handle(Protocol::Basic::GetEmpty) do |client, frame|
444
- channel = client.connection.channels[frame.channel]
443
+ self.handle(Protocol::Basic::GetEmpty) do |connection, frame|
444
+ channel = connection.channels[frame.channel]
445
445
  queue = channel.queues_awaiting_get_response.shift
446
446
 
447
447
  queue.handle_get_empty(frame.decode_payload)