amq-client 0.7.0.alpha29 → 0.7.0.alpha30
Sign up to get free protection for your applications and to get access to all the features.
@@ -33,7 +33,7 @@ module AMQ
|
|
33
33
|
# @option settings [String] :broker (nil) Broker name (use if you intend to use broker-specific features).
|
34
34
|
# @option settings [Fixnum] :frame_max (131072) Maximum frame size to use. If broker cannot support frames this large, broker's maximum value will be used instead.
|
35
35
|
#
|
36
|
-
# @
|
36
|
+
# @param [Hash] settings
|
37
37
|
def self.connect(settings = {}, &block)
|
38
38
|
@settings = Settings.configure(settings)
|
39
39
|
|
data/lib/amq/client/channel.rb
CHANGED
@@ -87,6 +87,9 @@ module AMQ
|
|
87
87
|
@connection
|
88
88
|
end # connection
|
89
89
|
|
90
|
+
|
91
|
+
# @group Channel lifecycle
|
92
|
+
|
90
93
|
# Opens AMQP channel.
|
91
94
|
#
|
92
95
|
# @api public
|
@@ -107,6 +110,11 @@ module AMQ
|
|
107
110
|
self.redefine_callback :close, &block
|
108
111
|
end
|
109
112
|
|
113
|
+
# @endgroup
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
# @group Message acknowledgements
|
110
118
|
|
111
119
|
# Acknowledge one or all messages on the channel.
|
112
120
|
#
|
@@ -128,18 +136,6 @@ module AMQ
|
|
128
136
|
self
|
129
137
|
end # reject(delivery_tag, requeue = true)
|
130
138
|
|
131
|
-
# Requests a specific quality of service. The QoS can be specified for the current channel
|
132
|
-
# or for all channels on the connection.
|
133
|
-
#
|
134
|
-
# @note RabbitMQ as of 2.3.1 does not support prefetch_size.
|
135
|
-
# @api public
|
136
|
-
def qos(prefetch_size = 0, prefetch_count = 32, global = false, &block)
|
137
|
-
@connection.send_frame(Protocol::Basic::Qos.encode(@id, prefetch_size, prefetch_count, global))
|
138
|
-
|
139
|
-
self.redefine_callback :qos, &block
|
140
|
-
self
|
141
|
-
end # qos(prefetch_size = 4096, prefetch_count = 32, global = false, &block)
|
142
|
-
|
143
139
|
# Notifies AMQ broker that consumer has recovered and unacknowledged messages need
|
144
140
|
# to be redelivered.
|
145
141
|
#
|
@@ -155,13 +151,31 @@ module AMQ
|
|
155
151
|
self
|
156
152
|
end # recover(requeue = false, &block)
|
157
153
|
|
154
|
+
# @endgroup
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
# @group QoS and flow handling
|
159
|
+
|
160
|
+
# Requests a specific quality of service. The QoS can be specified for the current channel
|
161
|
+
# or for all channels on the connection.
|
162
|
+
#
|
163
|
+
# @note RabbitMQ as of 2.3.1 does not support prefetch_size.
|
164
|
+
# @api public
|
165
|
+
def qos(prefetch_size = 0, prefetch_count = 32, global = false, &block)
|
166
|
+
@connection.send_frame(Protocol::Basic::Qos.encode(@id, prefetch_size, prefetch_count, global))
|
167
|
+
|
168
|
+
self.redefine_callback :qos, &block
|
169
|
+
self
|
170
|
+
end # qos(prefetch_size = 4096, prefetch_count = 32, global = false, &block)
|
171
|
+
|
158
172
|
# Asks the peer to pause or restart the flow of content data sent to a consumer.
|
159
173
|
# This is a simple flowcontrol mechanism that a peer can use to avoid overflowing its
|
160
174
|
# queues or otherwise finding itself receiving more messages than it can process. Note that
|
161
175
|
# this method is not intended for window control. It does not affect contents returned to
|
162
176
|
# Queue#get callers.
|
163
177
|
#
|
164
|
-
# @param [Boolean] Desired flow state.
|
178
|
+
# @param [Boolean] active Desired flow state.
|
165
179
|
#
|
166
180
|
# @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.5.2.3.)
|
167
181
|
# @api public
|
@@ -172,6 +186,18 @@ module AMQ
|
|
172
186
|
self
|
173
187
|
end # flow(active = false, &block)
|
174
188
|
|
189
|
+
# @return [Boolean] True if flow in this channel is active (messages will be delivered to consumers that use this channel).
|
190
|
+
#
|
191
|
+
# @api public
|
192
|
+
def flow_is_active?
|
193
|
+
@flow_is_active
|
194
|
+
end # flow_is_active?
|
195
|
+
|
196
|
+
# @endgroup
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
# @group Transactions
|
175
201
|
|
176
202
|
# Sets the channel to use standard transactions. One must use this method at least
|
177
203
|
# once on a channel before using #tx_tommit or tx_rollback methods.
|
@@ -204,12 +230,11 @@ module AMQ
|
|
204
230
|
self
|
205
231
|
end # tx_rollback(&block)
|
206
232
|
|
207
|
-
# @
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
end # flow_is_active?
|
233
|
+
# @endgroup
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
# @group Error handling
|
213
238
|
|
214
239
|
# Defines a callback that will be executed when channel is closed after
|
215
240
|
# channel-level exception.
|
@@ -219,6 +244,8 @@ module AMQ
|
|
219
244
|
self.define_callback(:error, &block)
|
220
245
|
end
|
221
246
|
|
247
|
+
# @endgroup
|
248
|
+
|
222
249
|
|
223
250
|
#
|
224
251
|
# Implementation
|
@@ -230,6 +257,12 @@ module AMQ
|
|
230
257
|
@exchanges[exchange.name] = exchange
|
231
258
|
end # register_exchange(exchange)
|
232
259
|
|
260
|
+
# Finds exchange in the exchanges cache on this channel by name. Exchange only exists in the cache if
|
261
|
+
# it was previously instantiated on this channel.
|
262
|
+
#
|
263
|
+
# @param [String] name Exchange name
|
264
|
+
# @return [AMQ::Client::Exchange] Exchange (if found)
|
265
|
+
# @api plugin
|
233
266
|
def find_exchange(name)
|
234
267
|
@exchanges[name]
|
235
268
|
end
|
@@ -16,7 +16,7 @@ module AMQ
|
|
16
16
|
# @see http://www.rabbitmq.com/amqp-0-9-1-quickref.html#basic.nack
|
17
17
|
def reject(delivery_tag, requeue = true, multi = false)
|
18
18
|
if multi
|
19
|
-
@
|
19
|
+
@connection.send_frame(Protocol::Basic::Nack.encode(self.id, delivery_tag, multi, requeue))
|
20
20
|
else
|
21
21
|
super(delivery_tag, requeue)
|
22
22
|
end
|
@@ -28,8 +28,8 @@ module AMQ
|
|
28
28
|
end # Extensions
|
29
29
|
|
30
30
|
class Channel
|
31
|
-
# use modules,
|
32
|
-
# instead of reckless monkey-patching. MK.
|
31
|
+
# use modules, the native Ruby way of extension of existing classes,
|
32
|
+
# instead of reckless monkey-patching. MK.
|
33
33
|
include Extensions::RabbitMQ::Basic::ChannelMixin
|
34
34
|
end
|
35
35
|
end # Client
|
@@ -104,7 +104,7 @@ module AMQ
|
|
104
104
|
|
105
105
|
@uses_publisher_confirmations = true
|
106
106
|
self.redefine_callback(:confirm_select, &block)
|
107
|
-
@
|
107
|
+
@connection.send_frame(Protocol::Confirm::Select.encode(@id, nowait))
|
108
108
|
|
109
109
|
self
|
110
110
|
end
|
@@ -190,21 +190,21 @@ module AMQ
|
|
190
190
|
|
191
191
|
|
192
192
|
def self.included(host)
|
193
|
-
host.handle(Protocol::Confirm::SelectOk) do |
|
193
|
+
host.handle(Protocol::Confirm::SelectOk) do |connection, frame|
|
194
194
|
method = frame.decode_payload
|
195
|
-
channel =
|
195
|
+
channel = connection.channels[frame.channel]
|
196
196
|
channel.handle_select_ok(method)
|
197
197
|
end
|
198
198
|
|
199
|
-
host.handle(Protocol::Basic::Ack) do |
|
199
|
+
host.handle(Protocol::Basic::Ack) do |connection, frame|
|
200
200
|
method = frame.decode_payload
|
201
|
-
channel =
|
201
|
+
channel = connection.channels[frame.channel]
|
202
202
|
channel.handle_basic_ack(method)
|
203
203
|
end
|
204
204
|
|
205
|
-
host.handle(Protocol::Basic::Nack) do |
|
205
|
+
host.handle(Protocol::Basic::Nack) do |connection, frame|
|
206
206
|
method = frame.decode_payload
|
207
|
-
channel =
|
207
|
+
channel = connection.channels[frame.channel]
|
208
208
|
channel.handle_basic_nack(method)
|
209
209
|
end
|
210
210
|
end # self.included(host)
|
data/lib/amq/client/version.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,10 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: amq-client
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.0.alpha30
|
5
5
|
prerelease: 6
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 7
|
9
|
-
- 0
|
10
|
-
- alpha
|
11
|
-
- 29
|
12
|
-
version: 0.7.0.alpha29
|
13
6
|
platform: ruby
|
14
|
-
authors:
|
7
|
+
authors:
|
15
8
|
- Jakub Stastny
|
16
9
|
- Michael S. Klishin
|
17
10
|
- Theo Hultberg
|
@@ -19,50 +12,40 @@ authors:
|
|
19
12
|
autorequire:
|
20
13
|
bindir: bin
|
21
14
|
cert_chain: []
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Dependency
|
15
|
+
date: 2011-05-29 00:00:00.000000000Z
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
26
18
|
name: eventmachine
|
27
|
-
|
28
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
requirement: &2168548660 !ruby/object:Gem::Requirement
|
29
20
|
none: false
|
30
|
-
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
|
34
|
-
segments:
|
35
|
-
- 0
|
36
|
-
version: "0"
|
21
|
+
requirements:
|
22
|
+
- - ! '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '0'
|
37
25
|
type: :runtime
|
38
|
-
version_requirements: *id001
|
39
|
-
- !ruby/object:Gem::Dependency
|
40
|
-
name: amq-protocol
|
41
26
|
prerelease: false
|
42
|
-
|
27
|
+
version_requirements: *2168548660
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: amq-protocol
|
30
|
+
requirement: &2168548020 !ruby/object:Gem::Requirement
|
43
31
|
none: false
|
44
|
-
requirements:
|
45
|
-
- -
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
hash: -3702664412
|
48
|
-
segments:
|
49
|
-
- 0
|
50
|
-
- 7
|
51
|
-
- 0
|
52
|
-
- alpha
|
53
|
-
- 4
|
32
|
+
requirements:
|
33
|
+
- - ! '>='
|
34
|
+
- !ruby/object:Gem::Version
|
54
35
|
version: 0.7.0.alpha4
|
55
36
|
type: :runtime
|
56
|
-
|
57
|
-
|
58
|
-
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: *2168548020
|
39
|
+
description: amq-client supports multiple networking adapters (EventMachine, TCP sockets,
|
40
|
+
cool.io) and supposed to back more opinionated AMQP clients (such as amqp gem, bunny,
|
41
|
+
et cetera) or be used directly in cases when access to more advanced AMQP 0.9.1
|
42
|
+
features is more important that convenient APIs
|
43
|
+
email:
|
59
44
|
- stastny@101ideas.cz
|
60
45
|
- michael@novemberain.com
|
61
46
|
executables: []
|
62
|
-
|
63
47
|
extensions: []
|
64
|
-
|
65
|
-
extra_rdoc_files:
|
48
|
+
extra_rdoc_files:
|
66
49
|
- README.textile
|
67
50
|
- doc/_index.html
|
68
51
|
- doc/AMQ.html
|
@@ -73,7 +56,7 @@ extra_rdoc_files:
|
|
73
56
|
- doc/index.html
|
74
57
|
- doc/method_list.html
|
75
58
|
- doc/top-level-namespace.html
|
76
|
-
files:
|
59
|
+
files:
|
77
60
|
- .gitignore
|
78
61
|
- .gitmodules
|
79
62
|
- .rspec
|
@@ -226,38 +209,26 @@ files:
|
|
226
209
|
- doc/top-level-namespace.html
|
227
210
|
homepage: http://github.com/ruby-amqp/amq-client
|
228
211
|
licenses: []
|
229
|
-
|
230
212
|
post_install_message:
|
231
213
|
rdoc_options: []
|
232
|
-
|
233
|
-
require_paths:
|
214
|
+
require_paths:
|
234
215
|
- lib
|
235
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
216
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
236
217
|
none: false
|
237
|
-
requirements:
|
238
|
-
- -
|
239
|
-
- !ruby/object:Gem::Version
|
240
|
-
|
241
|
-
|
242
|
-
- 0
|
243
|
-
version: "0"
|
244
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - ! '>='
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
245
223
|
none: false
|
246
|
-
requirements:
|
247
|
-
- -
|
248
|
-
- !ruby/object:Gem::Version
|
249
|
-
hash: 25
|
250
|
-
segments:
|
251
|
-
- 1
|
252
|
-
- 3
|
253
|
-
- 1
|
224
|
+
requirements:
|
225
|
+
- - ! '>'
|
226
|
+
- !ruby/object:Gem::Version
|
254
227
|
version: 1.3.1
|
255
228
|
requirements: []
|
256
|
-
|
257
229
|
rubyforge_project: amq-client
|
258
230
|
rubygems_version: 1.8.4
|
259
231
|
signing_key:
|
260
232
|
specification_version: 3
|
261
233
|
summary: amq-client is a fully-featured, low-level AMQP 0.9.1 client
|
262
234
|
test_files: []
|
263
|
-
|