amq-client 0.9.0.pre2 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/amq-client.gemspec +1 -1
- data/lib/amq/client/async/adapter.rb +19 -19
- data/lib/amq/client/async/channel.rb +4 -4
- data/lib/amq/client/async/queue.rb +11 -11
- data/lib/amq/client/exceptions.rb +2 -2
- data/lib/amq/client/version.rb +1 -1
- metadata +12 -16
data/amq-client.gemspec
CHANGED
@@ -39,54 +39,54 @@ module AMQ
|
|
39
39
|
|
40
40
|
# The locale defines the language in which the server will send reply texts.
|
41
41
|
#
|
42
|
-
# @see http://bit.ly/
|
42
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.2)
|
43
43
|
attr_accessor :locale
|
44
44
|
|
45
45
|
# Client capabilities
|
46
46
|
#
|
47
|
-
# @see http://bit.ly/
|
47
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.2.1)
|
48
48
|
attr_accessor :client_properties
|
49
49
|
|
50
50
|
# Server properties
|
51
51
|
#
|
52
|
-
# @see http://bit.ly/
|
52
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.1.3)
|
53
53
|
attr_reader :server_properties
|
54
54
|
|
55
55
|
# Server capabilities
|
56
56
|
#
|
57
|
-
# @see http://bit.ly/
|
57
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.1.3)
|
58
58
|
attr_reader :server_capabilities
|
59
59
|
|
60
60
|
# Locales server supports
|
61
61
|
#
|
62
|
-
# @see http://bit.ly/
|
62
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.1.3)
|
63
63
|
attr_reader :server_locales
|
64
64
|
|
65
65
|
# Authentication mechanism used.
|
66
66
|
#
|
67
|
-
# @see http://bit.ly/
|
67
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.2)
|
68
68
|
attr_reader :mechanism
|
69
69
|
|
70
70
|
# Authentication mechanisms broker supports.
|
71
71
|
#
|
72
|
-
# @see http://bit.ly/
|
72
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.2)
|
73
73
|
attr_reader :server_authentication_mechanisms
|
74
74
|
|
75
75
|
# Channels within this connection.
|
76
76
|
#
|
77
|
-
# @see http://bit.ly/
|
77
|
+
# @see http://bit.ly/amqp091spec AMQP 0.9.1 specification (Section 2.2.5)
|
78
78
|
attr_reader :channels
|
79
79
|
|
80
80
|
# Maximum channel number that the server permits this connection to use.
|
81
81
|
# Usable channel numbers are in the range 1..channel_max.
|
82
82
|
# Zero indicates no specified limit.
|
83
83
|
#
|
84
|
-
# @see http://bit.ly/
|
84
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Sections 1.4.2.5.1 and 1.4.2.6.1)
|
85
85
|
attr_accessor :channel_max
|
86
86
|
|
87
87
|
# Maximum frame size that the server permits this connection to use.
|
88
88
|
#
|
89
|
-
# @see http://bit.ly/
|
89
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Sections 1.4.2.5.2 and 1.4.2.6.2)
|
90
90
|
attr_accessor :frame_max
|
91
91
|
|
92
92
|
|
@@ -205,7 +205,7 @@ module AMQ
|
|
205
205
|
end
|
206
206
|
|
207
207
|
# Properly close connection with AMQ broker, as described in
|
208
|
-
# section 2.2.4 of the {http://bit.ly/
|
208
|
+
# section 2.2.4 of the {http://bit.ly/amqp091spec AMQP 0.9.1 specification}.
|
209
209
|
#
|
210
210
|
# @api plugin
|
211
211
|
# @see #close_connection
|
@@ -234,7 +234,7 @@ module AMQ
|
|
234
234
|
#
|
235
235
|
# @note This must be implemented by all AMQP clients.
|
236
236
|
# @api plugin
|
237
|
-
# @see http://bit.ly/
|
237
|
+
# @see http://bit.ly/amqp091spec AMQP 0.9.1 specification (Section 2.2)
|
238
238
|
def send_preamble
|
239
239
|
self.send_raw(AMQ::Protocol::PREAMBLE)
|
240
240
|
end
|
@@ -272,7 +272,7 @@ module AMQ
|
|
272
272
|
# Zero means the server does not want a heartbeat.
|
273
273
|
#
|
274
274
|
# @return [Fixnum] Heartbeat interval this client uses, in seconds.
|
275
|
-
# @see http://bit.ly/
|
275
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.6)
|
276
276
|
def heartbeat_interval
|
277
277
|
@settings[:heartbeat] || @settings[:heartbeat_interval] || 0
|
278
278
|
end # heartbeat_interval
|
@@ -488,7 +488,7 @@ module AMQ
|
|
488
488
|
# Sends connection.open to the server.
|
489
489
|
#
|
490
490
|
# @api plugin
|
491
|
-
# @see http://bit.ly/
|
491
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.7)
|
492
492
|
def open(vhost = "/")
|
493
493
|
self.send_frame(Protocol::Connection::Open.encode(vhost))
|
494
494
|
end
|
@@ -572,7 +572,7 @@ module AMQ
|
|
572
572
|
# Handles connection.start.
|
573
573
|
#
|
574
574
|
# @api plugin
|
575
|
-
# @see http://bit.ly/
|
575
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.1.)
|
576
576
|
def handle_start(connection_start)
|
577
577
|
@server_properties = connection_start.server_properties
|
578
578
|
@server_capabilities = @server_properties["capabilities"]
|
@@ -595,7 +595,7 @@ module AMQ
|
|
595
595
|
# Handles Connection.Tune-Ok.
|
596
596
|
#
|
597
597
|
# @api plugin
|
598
|
-
# @see http://bit.ly/
|
598
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.6)
|
599
599
|
def handle_tune(tune_ok)
|
600
600
|
@channel_max = tune_ok.channel_max.freeze
|
601
601
|
@frame_max = tune_ok.frame_max.freeze
|
@@ -608,7 +608,7 @@ module AMQ
|
|
608
608
|
# Handles Connection.Open-Ok.
|
609
609
|
#
|
610
610
|
# @api plugin
|
611
|
-
# @see http://bit.ly/
|
611
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.8.)
|
612
612
|
def handle_open_ok(open_ok)
|
613
613
|
@known_hosts = open_ok.known_hosts.dup.freeze
|
614
614
|
|
@@ -620,7 +620,7 @@ module AMQ
|
|
620
620
|
# Handles connection.close. When broker detects a connection level exception, this method is called.
|
621
621
|
#
|
622
622
|
# @api plugin
|
623
|
-
# @see http://bit.ly/
|
623
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.5.2.9)
|
624
624
|
def handle_close(conn_close)
|
625
625
|
closed!
|
626
626
|
self.exec_callback_yielding_self(:error, conn_close)
|
@@ -630,7 +630,7 @@ module AMQ
|
|
630
630
|
# Handles Connection.Close-Ok.
|
631
631
|
#
|
632
632
|
# @api plugin
|
633
|
-
# @see http://bit.ly/
|
633
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.10)
|
634
634
|
def handle_close_ok(close_ok)
|
635
635
|
closed!
|
636
636
|
self.disconnection_successful
|
@@ -133,7 +133,7 @@ module AMQ
|
|
133
133
|
# Acknowledge one or all messages on the channel.
|
134
134
|
#
|
135
135
|
# @api public
|
136
|
-
# @see http://bit.ly/
|
136
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.8.3.13.)
|
137
137
|
def acknowledge(delivery_tag, multiple = false)
|
138
138
|
@connection.send_frame(Protocol::Basic::Ack.encode(self.id, delivery_tag, multiple))
|
139
139
|
|
@@ -143,7 +143,7 @@ module AMQ
|
|
143
143
|
# Reject a message with given delivery tag.
|
144
144
|
#
|
145
145
|
# @api public
|
146
|
-
# @see http://bit.ly/
|
146
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.8.3.14.)
|
147
147
|
def reject(delivery_tag, requeue = true)
|
148
148
|
@connection.send_frame(Protocol::Basic::Reject.encode(self.id, delivery_tag, requeue))
|
149
149
|
|
@@ -156,7 +156,7 @@ module AMQ
|
|
156
156
|
# @return [Channel] self
|
157
157
|
#
|
158
158
|
# @note RabbitMQ as of 2.3.1 does not support basic.recover with requeue = false.
|
159
|
-
# @see http://bit.ly/
|
159
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.8.3.16.)
|
160
160
|
# @api public
|
161
161
|
def recover(requeue = true, &block)
|
162
162
|
@connection.send_frame(Protocol::Basic::Recover.encode(@id, requeue))
|
@@ -191,7 +191,7 @@ module AMQ
|
|
191
191
|
#
|
192
192
|
# @param [Boolean] active Desired flow state.
|
193
193
|
#
|
194
|
-
# @see http://bit.ly/
|
194
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.5.2.3.)
|
195
195
|
# @api public
|
196
196
|
def flow(active = false, &block)
|
197
197
|
@connection.send_frame(Protocol::Channel::Flow.encode(@id, active))
|
@@ -102,7 +102,7 @@ module AMQ
|
|
102
102
|
# @return [Queue] self
|
103
103
|
#
|
104
104
|
# @api public
|
105
|
-
# @see http://bit.ly/
|
105
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.7.2.1.)
|
106
106
|
def declare(passive = false, durable = false, exclusive = false, auto_delete = false, nowait = false, arguments = nil, &block)
|
107
107
|
raise ArgumentError, "declaration with nowait does not make sense for server-named queues! Either specify name other than empty string or use #declare without nowait" if nowait && self.anonymous?
|
108
108
|
|
@@ -159,7 +159,7 @@ module AMQ
|
|
159
159
|
# @return [Queue] self
|
160
160
|
#
|
161
161
|
# @api public
|
162
|
-
# @see http://bit.ly/
|
162
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.7.2.9.)
|
163
163
|
def delete(if_unused = false, if_empty = false, nowait = false, &block)
|
164
164
|
nowait = true unless block
|
165
165
|
@connection.send_frame(Protocol::Queue::Delete.encode(@channel.id, @name, if_unused, if_empty, nowait))
|
@@ -182,7 +182,7 @@ module AMQ
|
|
182
182
|
# @return [Queue] self
|
183
183
|
#
|
184
184
|
# @api public
|
185
|
-
# @see http://bit.ly/
|
185
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.7.2.3.)
|
186
186
|
def bind(exchange, routing_key = AMQ::Protocol::EMPTY_STRING, nowait = false, arguments = nil, &block)
|
187
187
|
nowait = true unless block
|
188
188
|
exchange_name = if exchange.respond_to?(:name)
|
@@ -211,7 +211,7 @@ module AMQ
|
|
211
211
|
# @return [Queue] self
|
212
212
|
#
|
213
213
|
# @api public
|
214
|
-
# @see http://bit.ly/
|
214
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.7.2.5.)
|
215
215
|
def unbind(exchange, routing_key = AMQ::Protocol::EMPTY_STRING, arguments = nil, &block)
|
216
216
|
exchange_name = if exchange.respond_to?(:name)
|
217
217
|
exchange.name
|
@@ -256,7 +256,7 @@ module AMQ
|
|
256
256
|
# @return [Queue] self
|
257
257
|
#
|
258
258
|
# @api public
|
259
|
-
# @see http://bit.ly/
|
259
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.8.3.3.)
|
260
260
|
def consume(no_ack = false, exclusive = false, nowait = false, no_local = false, arguments = nil, &block)
|
261
261
|
raise RuntimeError.new("This queue already has default consumer. Please instantiate AMQ::Client::Consumer directly to register additional consumers.") if @default_consumer
|
262
262
|
|
@@ -271,7 +271,7 @@ module AMQ
|
|
271
271
|
# @return [Queue] self
|
272
272
|
#
|
273
273
|
# @api public
|
274
|
-
# @see http://bit.ly/
|
274
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.8.3.5.)
|
275
275
|
def cancel(nowait = false, &block)
|
276
276
|
raise "There is no default consumer 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 @default_consumer.nil?
|
277
277
|
|
@@ -289,7 +289,7 @@ module AMQ
|
|
289
289
|
|
290
290
|
|
291
291
|
# @api public
|
292
|
-
# @see http://bit.ly/
|
292
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Sections 1.8.3.9)
|
293
293
|
def on_delivery(&block)
|
294
294
|
@default_consumer.on_delivery(&block)
|
295
295
|
end # on_delivery(&block)
|
@@ -299,7 +299,7 @@ module AMQ
|
|
299
299
|
# @return [Queue] self
|
300
300
|
#
|
301
301
|
# @api public
|
302
|
-
# @see http://bit.ly/
|
302
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.8.3.10.)
|
303
303
|
def get(no_ack = false, &block)
|
304
304
|
@connection.send_frame(Protocol::Basic::Get.encode(@channel.id, @name, no_ack))
|
305
305
|
|
@@ -320,7 +320,7 @@ module AMQ
|
|
320
320
|
# @return [Queue] self
|
321
321
|
#
|
322
322
|
# @api public
|
323
|
-
# @see http://bit.ly/
|
323
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.7.2.7.)
|
324
324
|
def purge(nowait = false, &block)
|
325
325
|
nowait = true unless block
|
326
326
|
@connection.send_frame(Protocol::Queue::Purge.encode(@channel.id, @name, nowait))
|
@@ -344,7 +344,7 @@ module AMQ
|
|
344
344
|
# @return [Queue] self
|
345
345
|
#
|
346
346
|
# @api public
|
347
|
-
# @see http://bit.ly/
|
347
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.8.3.13.)
|
348
348
|
def acknowledge(delivery_tag)
|
349
349
|
@channel.acknowledge(delivery_tag)
|
350
350
|
|
@@ -355,7 +355,7 @@ module AMQ
|
|
355
355
|
# @return [Queue] self
|
356
356
|
#
|
357
357
|
# @api public
|
358
|
-
# @see http://bit.ly/
|
358
|
+
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.8.3.14.)
|
359
359
|
def reject(delivery_tag, requeue = true)
|
360
360
|
@channel.reject(delivery_tag, requeue)
|
361
361
|
|
@@ -29,7 +29,7 @@ module AMQ
|
|
29
29
|
# Raised by adapters when frame does not end with {final octet AMQ::Protocol::Frame::FINAL_OCTET}.
|
30
30
|
# This suggest that there is a bug in adapter or AMQ broker implementation.
|
31
31
|
#
|
32
|
-
# @see http://bit.ly/
|
32
|
+
# @see http://bit.ly/amqp091spec AMQP 0.9.1 specification (Section 2.3)
|
33
33
|
class NoFinalOctetError < InconsistentDataError
|
34
34
|
def initialize
|
35
35
|
super("Frame doesn't end with #{AMQ::Protocol::Frame::FINAL_OCTET} as it must, which means the size is miscalculated.")
|
@@ -40,7 +40,7 @@ module AMQ
|
|
40
40
|
# to the size specified in that frame's header.
|
41
41
|
# This suggest that there is a bug in adapter or AMQ broker implementation.
|
42
42
|
#
|
43
|
-
# @see http://bit.ly/
|
43
|
+
# @see http://bit.ly/amqp091spec AMQP 0.9.1 specification (Section 2.3)
|
44
44
|
class BadLengthError < InconsistentDataError
|
45
45
|
def initialize(expected_length, actual_length)
|
46
46
|
super("Frame payload should be #{expected_length} long, but it's #{actual_length} long.")
|
data/lib/amq/client/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amq-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 59
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
9
|
- 0
|
10
|
-
|
11
|
-
- 2
|
12
|
-
version: 0.9.0.pre2
|
10
|
+
version: 0.9.0
|
13
11
|
platform: ruby
|
14
12
|
authors:
|
15
13
|
- Jakub Stastny
|
@@ -20,7 +18,7 @@ autorequire:
|
|
20
18
|
bindir: bin
|
21
19
|
cert_chain: []
|
22
20
|
|
23
|
-
date: 2012-01-
|
21
|
+
date: 2012-01-11 00:00:00 Z
|
24
22
|
dependencies:
|
25
23
|
- !ruby/object:Gem::Dependency
|
26
24
|
name: eventmachine
|
@@ -44,12 +42,12 @@ dependencies:
|
|
44
42
|
requirements:
|
45
43
|
- - ">="
|
46
44
|
- !ruby/object:Gem::Version
|
47
|
-
hash:
|
45
|
+
hash: 59
|
48
46
|
segments:
|
49
47
|
- 0
|
50
|
-
-
|
51
|
-
-
|
52
|
-
version: 0.
|
48
|
+
- 9
|
49
|
+
- 0
|
50
|
+
version: 0.9.0
|
53
51
|
type: :runtime
|
54
52
|
version_requirements: *id002
|
55
53
|
description: amq-client is a fully-featured, low-level AMQP 0.9.1 client with pluggable networking I/O adapters (EventMachine, cool.io, Eventpanda and so on) and supposed to back more opinionated AMQP clients (such as amqp gem) or be used directly in cases when access to more advanced AMQP 0.9.1 features is more important that convenient APIs
|
@@ -242,14 +240,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
242
240
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
241
|
none: false
|
244
242
|
requirements:
|
245
|
-
- - "
|
243
|
+
- - ">="
|
246
244
|
- !ruby/object:Gem::Version
|
247
|
-
hash:
|
245
|
+
hash: 3
|
248
246
|
segments:
|
249
|
-
-
|
250
|
-
|
251
|
-
- 1
|
252
|
-
version: 1.3.1
|
247
|
+
- 0
|
248
|
+
version: "0"
|
253
249
|
requirements: []
|
254
250
|
|
255
251
|
rubyforge_project: amq-client
|