amq-client 0.9.4 → 0.9.5
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.
- data/.gitignore +1 -0
- data/.travis.yml +4 -1
- data/lib/amq/client/async/channel.rb +6 -0
- data/lib/amq/client/async/consumer.rb +1 -0
- data/lib/amq/client/async/extensions/rabbitmq/cancel.rb +59 -0
- data/lib/amq/client/extensions/rabbitmq.rb +1 -0
- data/lib/amq/client/extensions/rabbitmq/cancel.rb +18 -0
- data/lib/amq/client/settings.rb +8 -7
- data/lib/amq/client/version.rb +1 -1
- data/spec/integration/coolio/exchange_declare_spec.rb +0 -1
- data/spec/integration/eventmachine/exchange_declare_spec.rb +0 -1
- metadata +6 -4
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -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
|
@@ -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
|
data/lib/amq/client/settings.rb
CHANGED
@@ -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
|
|
data/lib/amq/client/version.rb
CHANGED
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:
|
4
|
+
hash: 49
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
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-
|
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
|