amq-protocol 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -5
- data/Gemfile +0 -1
- data/LICENSE +1 -0
- data/README.md +43 -0
- data/amq-protocol.gemspec +2 -1
- data/codegen.py +1 -1
- data/generate.rb +18 -0
- data/lib/amq/protocol/client.rb +233 -98
- data/lib/amq/protocol/version.rb +1 -1
- data/post-processing.rb +1 -1
- data/protocol.rb.pytemplate +1 -5
- data/spec/amq/protocol/basic_spec.rb +8 -0
- data/spec/amq/protocol/method_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -0
- metadata +11 -10
- data/README.textile +0 -50
- data/tasks.rb +0 -43
data/lib/amq/protocol/version.rb
CHANGED
data/post-processing.rb
CHANGED
data/protocol.rb.pytemplate
CHANGED
@@ -188,11 +188,10 @@ module AMQ
|
|
188
188
|
|
189
189
|
# See https://dev.rabbitmq.com/wiki/Amqp091Errata#section_11
|
190
190
|
limit = frame_size - 8
|
191
|
-
limit_plus_1 = limit + 1
|
192
191
|
|
193
192
|
array = Array.new
|
194
193
|
while body
|
195
|
-
payload, body = body[0,
|
194
|
+
payload, body = body[0, limit], body[limit, body.length - limit]
|
196
195
|
# array << [0x03, payload]
|
197
196
|
array << BodyFrame.new(payload, channel)
|
198
197
|
end
|
@@ -386,9 +385,6 @@ module AMQ
|
|
386
385
|
frames + self.encode_body(payload, channel, frame_size)
|
387
386
|
% endif
|
388
387
|
% else:
|
389
|
-
% if os.getenv("DEVELOPMENT"):
|
390
|
-
STDERR.puts("~ [\e[31m#{channel}\e[m] \e[32m${klass.name}.${method.name}\e[m(${", ".join([method + "=#{" + method + ".inspect}" for method in method.not_ignored_args()])})") if $DEBUG
|
391
|
-
% endif
|
392
388
|
MethodFrame.new(buffer, channel)
|
393
389
|
% endif
|
394
390
|
end
|
@@ -138,6 +138,14 @@ module AMQ
|
|
138
138
|
method_frame.channel.should == 1
|
139
139
|
end
|
140
140
|
end
|
141
|
+
|
142
|
+
describe '.decode' do
|
143
|
+
subject do
|
144
|
+
CancelOk.decode("\x03foo\x01")
|
145
|
+
end
|
146
|
+
|
147
|
+
its(:consumer_tag) { should == 'foo' }
|
148
|
+
end
|
141
149
|
end
|
142
150
|
|
143
151
|
describe CancelOk do
|
@@ -25,11 +25,11 @@ module AMQ
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
context 'when the body is
|
28
|
+
context 'when the body is too big to fit in a single frame' do
|
29
29
|
it 'encodes a body into a list of BodyFrames that each fit within the frame size' do
|
30
30
|
lipsum = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
|
31
31
|
frame_size = 100
|
32
|
-
expected_payload_size =
|
32
|
+
expected_payload_size = 92
|
33
33
|
body_frames = Method.encode_body(lipsum, 1, frame_size)
|
34
34
|
body_frames.map(&:payload).should == lipsum.split('').each_slice(expected_payload_size).map(&:join)
|
35
35
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amq-protocol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 57
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 1
|
10
|
+
version: 0.9.1
|
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-06-22 00:00:00 Z
|
22
22
|
dependencies: []
|
23
23
|
|
24
24
|
description: " amq-protocol is an AMQP 0.9.1 serialization library for Ruby. It is not an\n AMQP client: amq-protocol only handles serialization and deserialization.\n If you want to write your own AMQP client, this gem can help you with that.\n"
|
@@ -30,7 +30,7 @@ executables: []
|
|
30
30
|
extensions: []
|
31
31
|
|
32
32
|
extra_rdoc_files:
|
33
|
-
- README.
|
33
|
+
- README.md
|
34
34
|
files:
|
35
35
|
- .gitignore
|
36
36
|
- .gitmodules
|
@@ -39,12 +39,13 @@ files:
|
|
39
39
|
- Gemfile
|
40
40
|
- LICENSE
|
41
41
|
- PROFILING.md
|
42
|
-
- README.
|
42
|
+
- README.md
|
43
43
|
- __init__.py
|
44
44
|
- amq-protocol.gemspec
|
45
45
|
- amqp_0.9.1_changes.json
|
46
46
|
- codegen.py
|
47
47
|
- codegen_helpers.py
|
48
|
+
- generate.rb
|
48
49
|
- irb.rb
|
49
50
|
- lib/amq/hacks.rb
|
50
51
|
- lib/amq/protocol.rb
|
@@ -73,10 +74,9 @@ files:
|
|
73
74
|
- spec/amq/protocol/value_encoder_spec.rb
|
74
75
|
- spec/amq/protocol_spec.rb
|
75
76
|
- spec/spec_helper.rb
|
76
|
-
- tasks.rb
|
77
77
|
homepage: http://github.com/ruby-amqp/amq-protocol
|
78
|
-
licenses:
|
79
|
-
|
78
|
+
licenses:
|
79
|
+
- MIT
|
80
80
|
post_install_message:
|
81
81
|
rdoc_options: []
|
82
82
|
|
@@ -103,9 +103,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
requirements: []
|
104
104
|
|
105
105
|
rubyforge_project: amq-protocol
|
106
|
-
rubygems_version: 1.8.
|
106
|
+
rubygems_version: 1.8.15
|
107
107
|
signing_key:
|
108
108
|
specification_version: 3
|
109
109
|
summary: AMQP 0.9.1 encoder & decoder.
|
110
110
|
test_files: []
|
111
111
|
|
112
|
+
has_rdoc:
|
data/README.textile
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
h1. About amq-protocol.
|
2
|
-
|
3
|
-
amq-protocol is an AMQP 0.9.1 serialization library for Ruby. It is not an
|
4
|
-
AMQP client: amq-protocol only handles serialization and deserialization.
|
5
|
-
If you want to write your own AMQP client, this gem can help you with that.
|
6
|
-
|
7
|
-
h2. How does amq-protocol relate to amqp gem, amq-client and libraries like bunny?
|
8
|
-
|
9
|
-
See "this page about AMQP gems family":https://github.com/ruby-amqp/amq-client/blob/master/README.textile
|
10
|
-
|
11
|
-
|
12
|
-
h2. Installation
|
13
|
-
|
14
|
-
If you use Bundler and want to use the very latest version, add this to your Gemfile:
|
15
|
-
|
16
|
-
<pre>
|
17
|
-
gem 'amq-protocol', :git => 'https://github.com/ruby-amqp/amq-protocol.git'
|
18
|
-
</pre>
|
19
|
-
|
20
|
-
|
21
|
-
h2. Development
|
22
|
-
|
23
|
-
h3. Inspection
|
24
|
-
|
25
|
-
If you need to see what AMQP methods are encoded, just regenerate the protocol file using @./tasks.rb generate --development@ and then set @$DEBUG@ to @true@ for which parts of code you want to see the debug statements.
|
26
|
-
|
27
|
-
!http://static.101ideas.cz/amqp-debug.png!
|
28
|
-
|
29
|
-
h3. Contributing
|
30
|
-
|
31
|
-
If you want to change some code, don't edit @lib/amq/protocol/client.rb@ —
|
32
|
-
that file is generated from @protocol.rb.pytemplate@
|
33
|
-
which is a template file used by @codegen.py@. You can re-generate by running
|
34
|
-
<pre>nake ./tasks.rb generate</pre>
|
35
|
-
Please note that nake gem only runs on Ruby 1.9.2.
|
36
|
-
|
37
|
-
|
38
|
-
## Maintainer Information
|
39
|
-
|
40
|
-
amq-protocol is maintained by [Michael Klishin](https://github.com/michaelklishin).
|
41
|
-
|
42
|
-
|
43
|
-
h2. Links
|
44
|
-
|
45
|
-
* "API Documentation":http://rdoc.info/github/ruby-amqp/amq-protocol/master/frames
|
46
|
-
* "Examples":https://github.com/ruby-amqp/amq-protocol/tree/master/examples/
|
47
|
-
* "Jabber room for contributors":xmpp://amqp-dev@conf.netlab.cz
|
48
|
-
* "Ruby AMQP mailing list":http://groups.google.com/group/ruby-amqp
|
49
|
-
* "Issue tracker":http://github.com/ruby-amqp/amq-protocol/issues
|
50
|
-
* "Continous integration server":http://travis-ci.org/#!/ruby-amqp/amq-protocol
|
data/tasks.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bundle exec nake
|
2
|
-
# encoding: utf-8
|
3
|
-
|
4
|
-
# ./tasks.rb generate
|
5
|
-
# ./tasks.rb generate --targets=all,
|
6
|
-
# ./tasks.rb generate --targets=client,server
|
7
|
-
# ./tasks.rb generate --development
|
8
|
-
Task.new(:generate) do |task|
|
9
|
-
task.description = "Generate lib/amq/protocol/client.rb"
|
10
|
-
|
11
|
-
def self.valid_choices
|
12
|
-
["client", "server", "all"]
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.check_validity_of_target(target)
|
16
|
-
unless self.valid_choices.include?(target)
|
17
|
-
abort "Target can be one #{valid_choices.inspect}, not #{target.inspect}"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
task.define do |opts, spec = nil|
|
22
|
-
opts[:targets] ||= ["client"]
|
23
|
-
|
24
|
-
if spec.nil?
|
25
|
-
spec = "vendor/rabbitmq-codegen/amqp-rabbitmq-0.9.1.json"
|
26
|
-
unless File.exist?(spec)
|
27
|
-
sh "git submodule update --init"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
opts[:targets].each do |type|
|
32
|
-
self.check_validity_of_target(type)
|
33
|
-
path = "lib/amq/protocol/#{type}.rb"
|
34
|
-
sh "DEVELOPMENT=#{opts[:development]} ./codegen.py #{type} #{spec} #{path}"
|
35
|
-
if File.file?(path)
|
36
|
-
sh "./post-processing.rb #{path}"
|
37
|
-
sh "ruby -c #{path}"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
Task.tasks.default = Task[:generate] # FIXME: it doesn't work now
|