amq-client 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -8,3 +8,4 @@ doc/*
8
8
  Gemfile.lock
9
9
  vendor
10
10
  .rbx/*
11
+ bin/*
@@ -19,4 +19,7 @@ branches:
19
19
  only:
20
20
  - master
21
21
  - 0.9.x-stable
22
- - 0.8.x-stable
22
+ - 0.8.x-stable
23
+
24
+ services:
25
+ - rabbitmq
@@ -412,7 +412,13 @@ module AMQ
412
412
  # @private
413
413
  def handle_close(channel_close)
414
414
  self.status = :closed
415
+ # Confirm closing the channel so that the broker will actually release all resources.
416
+ # TODO: channel.close-ok in the Java client takes no arguments. Almost certainly
417
+ # this is an issue with our code generator. MK.
418
+ @connection.send_frame(Protocol::Channel::CloseOk.encode(@id))
419
+
415
420
  self.connection.clear_frames_on(self.id)
421
+
416
422
  self.exec_callback_yielding_self(:error, channel_close)
417
423
 
418
424
  self.handle_connection_interruption(channel_close)
@@ -83,6 +83,7 @@ module AMQ
83
83
  @connection.send_frame(Protocol::Basic::Cancel.encode(@channel.id, @consumer_tag, nowait))
84
84
  self.clear_callbacks(:delivery)
85
85
  self.clear_callbacks(:consume)
86
+ self.clear_callbacks(:scancel)
86
87
 
87
88
  self.unregister_with_channel
88
89
  self.unregister_with_queue
@@ -0,0 +1,59 @@
1
+ # encoding: utf-8
2
+
3
+ require "amq/client/async/channel"
4
+
5
+ # Basic.Cancel
6
+ module AMQ
7
+ module Client
8
+ module Async
9
+ module Extensions
10
+ module RabbitMQ
11
+ module Basic
12
+ module ConsumerMixin
13
+
14
+ def on_cancel(&block)
15
+ self.append_callback(:scancel, &block)
16
+
17
+ self
18
+ end # on_cancel(&block)
19
+
20
+ def handle_cancel(basic_cancel)
21
+ self.exec_callback(:scancel, basic_cancel)
22
+ end # handle_cancel(basic_cancel)
23
+
24
+ def self.included receiver
25
+ receiver.handle(Protocol::Basic::Cancel) do |connection, method_frame|
26
+ channel = connection.channels[method_frame.channel]
27
+ basic_cancel = method_frame.decode_payload
28
+ consumer = channel.consumers[basic_cancel.consumer_tag]
29
+
30
+ # Handle the delivery only if the consumer still exists.
31
+ consumer.handle_cancel(basic_cancel) if consumer
32
+ end
33
+ end
34
+
35
+ end # ConsumerMixin
36
+
37
+ module QueueMixin
38
+
39
+ # @api public
40
+ def on_cancel(&block)
41
+ @default_consumer.on_cancel(&block)
42
+ end # on_cancel(&block)
43
+ end
44
+
45
+ end # Basic
46
+ end # RabbitMQ
47
+ end # Extensions
48
+
49
+ class Consumer
50
+ include Extensions::RabbitMQ::Basic::ConsumerMixin
51
+ end # Consumer
52
+
53
+ class Queue
54
+ include Extensions::RabbitMQ::Basic::QueueMixin
55
+ end # Queue
56
+
57
+ end # Async
58
+ end # Client
59
+ end # AMQ
@@ -2,4 +2,5 @@
2
2
 
3
3
  # http://www.rabbitmq.com/extensions.html
4
4
  require "amq/client/extensions/rabbitmq/basic"
5
+ require "amq/client/extensions/rabbitmq/cancel"
5
6
  require "amq/client/extensions/rabbitmq/confirm"
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+
3
+ require "amq/client/async/extensions/rabbitmq/cancel"
4
+
5
+ # Basic.Nack
6
+ module AMQ
7
+ module Client
8
+ # backwards compatibility
9
+ # @private
10
+ Extensions = Async::Extensions unless defined?(Extensions)
11
+
12
+ module Settings
13
+ puts "Updating client properties"
14
+ CLIENT_PROPERTIES[:capabilities] ||= {}
15
+ CLIENT_PROPERTIES[:capabilities][:consumer_cancel_notify] = true
16
+ end
17
+ end # Client
18
+ end # AMQ
@@ -45,14 +45,15 @@ module AMQ
45
45
  }
46
46
  end
47
47
 
48
-
48
+ CLIENT_PROPERTIES = {
49
+ :platform => ::RUBY_DESCRIPTION,
50
+ :product => "AMQ Client",
51
+ :information => "http://github.com/ruby-amqp/amq-client",
52
+ :version => AMQ::Client::VERSION
53
+ }
54
+
49
55
  def self.client_properties
50
- @client_properties ||= {
51
- :platform => ::RUBY_DESCRIPTION,
52
- :product => "AMQ Client",
53
- :information => "http://github.com/ruby-amqp/amq-client",
54
- :version => AMQ::Client::VERSION
55
- }
56
+ @client_properties ||= CLIENT_PROPERTIES
56
57
  end
57
58
 
58
59
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AMQ
4
4
  module Client
5
- VERSION = "0.9.4"
5
+ VERSION = "0.9.5"
6
6
  end
7
7
  end
@@ -34,7 +34,6 @@ describe "AMQ::Client::CoolioClient", "Exchange.Declare", :nojruby => true do
34
34
  exchange.declare(true, false, false, false) do
35
35
  @callback_fired = true
36
36
  end
37
- delayed(0.1) { exchange.delete }
38
37
  done(0.5)
39
38
  end
40
39
  end
@@ -65,7 +65,6 @@ describe AMQ::Client::EventMachineClient, "Exchange.Declare" do
65
65
  exchange.declare(true, false, false, false) do
66
66
  @callback_fired = true
67
67
  end
68
- delayed(0.1) { exchange.delete }
69
68
  done(0.3)
70
69
  end
71
70
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amq-client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 49
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 4
10
- version: 0.9.4
9
+ - 5
10
+ version: 0.9.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jakub Stastny
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2012-07-05 00:00:00 Z
21
+ date: 2012-10-11 00:00:00 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: eventmachine
@@ -157,6 +157,7 @@ files:
157
157
  - lib/amq/client/async/entity.rb
158
158
  - lib/amq/client/async/exchange.rb
159
159
  - lib/amq/client/async/extensions/rabbitmq/basic.rb
160
+ - lib/amq/client/async/extensions/rabbitmq/cancel.rb
160
161
  - lib/amq/client/async/extensions/rabbitmq/confirm.rb
161
162
  - lib/amq/client/async/queue.rb
162
163
  - lib/amq/client/callbacks.rb
@@ -167,6 +168,7 @@ files:
167
168
  - lib/amq/client/exchange.rb
168
169
  - lib/amq/client/extensions/rabbitmq.rb
169
170
  - lib/amq/client/extensions/rabbitmq/basic.rb
171
+ - lib/amq/client/extensions/rabbitmq/cancel.rb
170
172
  - lib/amq/client/extensions/rabbitmq/confirm.rb
171
173
  - lib/amq/client/framing/io/frame.rb
172
174
  - lib/amq/client/framing/string/frame.rb