amqp 0.6.7 → 0.7.0.pre

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.
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path("../spec_helper", __FILE__)
4
+
5
+ EM.describe "MQ#close(&callback)" do
6
+ default_timeout 5
7
+
8
+ should "take a callback which will run when we get back Channel.Close-Ok" do
9
+ MQ.new.close do |amq|
10
+ done
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,41 @@
1
+ # encoding: utf-8
2
+
3
+ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
4
+
5
+ require "mq"
6
+ require "bacon"
7
+ require "em-spec/bacon"
8
+
9
+ # Notes about Bacon & EM-spec
10
+ # - Subsequent describe blocks don't work.
11
+ # - Bacon doesn't support any kind of pending specs.
12
+ # - Bacon doesn't support before(:all) hook (see bellow).
13
+ EM.spec_backend = EventMachine::Spec::Bacon
14
+
15
+ # Usage with tracer:
16
+ # 1) Start tracer on a PORT_NUMBER
17
+ # 2) ruby spec/sync_async_spec.rb amqp://localhost:PORT_NUMBER
18
+ if ARGV.first && ARGV.first.match(/^amqps?:/)
19
+ amqp_url = ARGV.first
20
+ puts "Using AMQP URL #{amqp_url}"
21
+ else
22
+ amqp_url = "amqp://localhost"
23
+ end
24
+
25
+ # Bacon doesn't seem to have some global before hook
26
+ Bacon::Context.class_eval do
27
+ alias_method :__initialize__, :initialize
28
+
29
+ # Let's use Module#define_method, so we can
30
+ # access local variables defined in parent scopes.
31
+ define_method(:initialize) do |*args, &block|
32
+ __initialize__(*args, &block)
33
+
34
+ # There's no support for before(:all), so we just
35
+ # save whatever AMQP.connect returns (we suppose
36
+ # it isn't nil) and use value = value || connect().
37
+ self.before do
38
+ @connected ||= AMQP.connect(amqp_url)
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,52 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path("../spec_helper", __FILE__)
4
+
5
+ EM.describe MQ::Queue do
6
+ default_timeout 5
7
+
8
+ before do
9
+ @mq = MQ.new
10
+ end
11
+
12
+ # Queue.Declare
13
+ should "update MQ::Queue#name by the name generated by the broker" do
14
+ @mq.queue("") do |queue, *args|
15
+ queue.name.should.not.be.empty
16
+ done
17
+ end
18
+ end
19
+
20
+ # PENDING: this spec is currently failing
21
+ # https://github.com/tmm1/amqp/issues/issue/31
22
+ should "be able to access message count" do
23
+ name = Array.new(16) { rand(256) }.pack("C*").unpack("H*").first
24
+ exchange = MQ.fanout("fanout")
25
+ @mq.queue!(name) do |queue, *args|
26
+ queue.bind(exchange) do
27
+ 3.times { exchange.publish("foobar") }
28
+ # We have 1 channel per 1 MQ instance, so we can just send a sync request
29
+ # and once the requst is finished, we can be sure that the previous one is
30
+ # finished as well. So we can be sure that all the Basic.Publish actions are done.
31
+ @mq.queue!(name) do |queue, message_count, *args|
32
+ message_count.should.eql 3
33
+ done
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ # TODO: this will require quite a lot of code, but it should be tested anyway.
40
+ # should "be able to access consumer count" do
41
+ # end
42
+
43
+ # Queue.Bind
44
+ should "work with a callback" do
45
+ exchange = MQ.fanout("fanout")
46
+ @mq.queue("") do |queue, *args|
47
+ queue.bind(exchange) do |*args|
48
+ done
49
+ end
50
+ end
51
+ end
52
+ end
metadata CHANGED
@@ -1,35 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amqp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ prerelease: true
5
+ segments:
6
+ - 0
7
+ - 7
8
+ - 0
9
+ - pre
10
+ version: 0.7.0.pre
5
11
  platform: ruby
6
12
  authors:
7
13
  - Aman Gupta
14
+ - Jakub Stastny aka botanicus
8
15
  autorequire:
9
16
  bindir: bin
10
- cert_chain: []
11
-
12
- date: 2009-12-29 00:00:00 -08:00
17
+ cert_chain:
18
+ date: 2011-01-05 00:00:00 +00:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: eventmachine
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ segments:
30
+ - 0
31
+ - 12
32
+ - 4
23
33
  version: 0.12.4
24
- version:
25
- description: An implementation of the AMQP protocol in Ruby/EventMachine for writing clients to the RabbitMQ message broker
26
- email: amqp@tmm1.net
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description: An implementation of the AMQP protocol in Ruby/EventMachine for writing clients to the RabbitMQ message broker.
37
+ email: stastny@101ideas.cz
27
38
  executables: []
28
39
 
29
40
  extensions: []
30
41
 
31
42
  extra_rdoc_files:
32
- - README
43
+ - README.md
33
44
  - doc/EXAMPLE_01_PINGPONG
34
45
  - doc/EXAMPLE_02_CLOCK
35
46
  - doc/EXAMPLE_03_STOCKS
@@ -38,10 +49,16 @@ extra_rdoc_files:
38
49
  - doc/EXAMPLE_05_POP
39
50
  - doc/EXAMPLE_06_HASHTABLE
40
51
  files:
41
- - README
52
+ - .gitignore
53
+ - CHANGELOG
54
+ - Gemfile
55
+ - Gemfile.lock
56
+ - README.md
42
57
  - Rakefile
43
58
  - amqp.gemspec
59
+ - amqp.pre.gemspec
44
60
  - amqp.todo
61
+ - bin/irb
45
62
  - doc/EXAMPLE_01_PINGPONG
46
63
  - doc/EXAMPLE_02_CLOCK
47
64
  - doc/EXAMPLE_03_STOCKS
@@ -51,28 +68,30 @@ files:
51
68
  - doc/EXAMPLE_06_HASHTABLE
52
69
  - examples/amqp/simple.rb
53
70
  - examples/mq/ack.rb
71
+ - examples/mq/callbacks.rb
54
72
  - examples/mq/clock.rb
55
- - examples/mq/pop.rb
56
73
  - examples/mq/hashtable.rb
57
74
  - examples/mq/internal.rb
58
75
  - examples/mq/logger.rb
59
76
  - examples/mq/multiclock.rb
60
77
  - examples/mq/pingpong.rb
78
+ - examples/mq/pop.rb
61
79
  - examples/mq/primes-simple.rb
62
80
  - examples/mq/primes.rb
63
81
  - examples/mq/stocks.rb
64
82
  - lib/amqp.rb
65
- - lib/amqp/version.rb
66
83
  - lib/amqp/buffer.rb
67
84
  - lib/amqp/client.rb
68
85
  - lib/amqp/frame.rb
69
86
  - lib/amqp/protocol.rb
70
87
  - lib/amqp/server.rb
71
88
  - lib/amqp/spec.rb
89
+ - lib/amqp/version.rb
72
90
  - lib/ext/blankslate.rb
73
91
  - lib/ext/em.rb
74
92
  - lib/ext/emfork.rb
75
93
  - lib/mq.rb
94
+ - lib/mq/collection.rb
76
95
  - lib/mq/exchange.rb
77
96
  - lib/mq/header.rb
78
97
  - lib/mq/logger.rb
@@ -92,33 +111,45 @@ files:
92
111
  - research/primes-forked.rb
93
112
  - research/primes-processes.rb
94
113
  - research/primes-threaded.rb
114
+ - spec/channel_close_spec.rb
115
+ - spec/spec_helper.rb
116
+ - spec/sync_async_spec.rb
95
117
  has_rdoc: true
96
- homepage: http://amqp.rubyforge.org/
118
+ homepage: http://github.com/tmm1/amqp
97
119
  licenses: []
98
120
 
99
- post_install_message:
121
+ post_install_message: "[\e[32mVersion 0.7\e[0m] [BUG] Sync API for queues and exchanges, support for server-generated queues & exchange names (via semi-lazy collection).\n\
122
+ [\e[32mVersion 0.7\e[0m] [BUG] Sync API for MQ#close (Channel.Close) [issue #34].\n\
123
+ [\e[32mVersion 0.7\e[0m] [FEATURE] From majek's fork, with some fixes. Example: AMQP.start(\"amqps://\")\n\
124
+ [\e[32mVersion 0.7\e[0m] [DEVELOP] some em-spec-based specs, bin/irb, Gemfile.\n"
100
125
  rdoc_options:
101
126
  - --include=examples
102
127
  require_paths:
103
128
  - lib
104
129
  required_ruby_version: !ruby/object:Gem::Requirement
130
+ none: false
105
131
  requirements:
106
132
  - - ">="
107
133
  - !ruby/object:Gem::Version
134
+ segments:
135
+ - 0
108
136
  version: "0"
109
- version:
110
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
+ none: false
111
139
  requirements:
112
- - - ">="
140
+ - - ">"
113
141
  - !ruby/object:Gem::Version
114
- version: "0"
115
- version:
142
+ segments:
143
+ - 1
144
+ - 3
145
+ - 1
146
+ version: 1.3.1
116
147
  requirements: []
117
148
 
118
149
  rubyforge_project: amqp
119
- rubygems_version: 1.3.5
150
+ rubygems_version: 1.3.7
120
151
  signing_key:
121
152
  specification_version: 3
122
- summary: AMQP client implementation in Ruby/EventMachine
153
+ summary: AMQP client implementation in Ruby/EventMachine.
123
154
  test_files: []
124
155
 
data/README DELETED
@@ -1,128 +0,0 @@
1
- Simple AMQP driver for Ruby/EventMachine
2
- (c) 2008 Aman Gupta (tmm1)
3
-
4
- http://github.com/tmm1/amqp
5
- http://rubyforge.org/projects/amqp
6
- http://hopper.squarespace.com/blog/2008/7/22/simple-amqp-library-for-ruby.html
7
- http://groups.google.com/group/ruby-amqp
8
- http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2008-July/001417.html
9
-
10
- This library works with Ruby 1.8, Ruby 1.9, JRuby and Rubinius, and is licensed under the Ruby License.
11
-
12
- This library was tested primarily with RabbitMQ, although it should be compatible with any
13
- server implementing the AMQP 0-8 spec.
14
-
15
- To use with RabbitMQ, first run the server:
16
-
17
- hg clone http://hg.rabbitmq.com/rabbitmq-codegen
18
- hg clone http://hg.rabbitmq.com/rabbitmq-server
19
- cd rabbitmq-server
20
- make run
21
-
22
- To get started, refer to the various bundled examples:
23
-
24
- ruby examples/mq/pingpong.rb # 1-1 communication using amq.direct
25
- ruby examples/mq/clock.rb # 1-N communication using amq.fanout
26
- ruby examples/mq/stocks.rb # 1-subscriber communication using amq.topic
27
-
28
- ruby examples/mq/multiclock.rb # header based routing (new rabbitmq feature)
29
- ruby examples/mq/ack.rb # using ack
30
- ruby examples/mq/pop.rb # pop off messages one at a time
31
-
32
- ruby examples/mq/hashtable.rb # simple async rpc layer
33
- ruby examples/mq/primes.rb 4 # parallelized prime number generation
34
- ruby examples/mq/logger.rb # simple logging api
35
-
36
- For more details into the lower level AMQP client API, run the simple client example:
37
-
38
- ruby examples/amqp/simple.rb # low-level AMQP api
39
- ruby examples/mq/internal.rb # low-level Queue/Exchange api
40
-
41
- Or refer to protocol/doc.txt, which enumerates packets sent between a server and client
42
- during a typical session, in both binary and decoded formats.
43
-
44
- To run the test suite:
45
-
46
- rake spec
47
-
48
- The lib/amqp/spec.rb file is generated automatically based on the AMQP specification. To generate it:
49
-
50
- rake codegen
51
-
52
- This project was inspired by py-amqplib, rabbitmq, qpid and rubbyt.
53
- Special thanks to Dmitriy Samovskiy, Ben Hood and Tony Garnock-Jones.
54
-
55
- AMQP resources:
56
-
57
- Servers:
58
- RabbitMQ (Rabbit Technologies, Erlang/OTP, MPL) - http://rabbitmq.com
59
- ZeroMQ (iMatix/FastMQ/Intel, C++, GPL3) - http://www.zeromq.org
60
- OpenAMQ (iMatix, C, GPL2) - http://openamq.org
61
- ActiveMQ (Apache Foundation, Java, apache2) - http://activemq.apache.org
62
-
63
- Steve Vinoski explains AMQP in his column, Towards Integration
64
- http://steve.vinoski.net/pdf/IEEE-Advanced_Message_Queuing_Protocol.pdf
65
-
66
- John O'Hara on the history of AMQP
67
- http://www.acmqueue.org/modules.php?name=Content&pa=showpage&pid=485
68
-
69
- Dmitriy's presentation on RabbitMQ/AMQP
70
- http://somic-org.homelinux.org/blog/2008/07/31/slides-for-my-amqprabbitmq-talk/
71
-
72
- ZeroMQ's analysis of the messaging technology market
73
- http://www.zeromq.org/whitepapers:market-analysis
74
-
75
- Pieter Hintjens's background to AMQP
76
- http://www.openamq.org/doc:amqp-background
77
-
78
- Barry Pederson's py-amqplib
79
- http://barryp.org/software/py-amqplib/
80
-
81
- Ben Hood on writing an AMQP client
82
- http://hopper.squarespace.com/blog/2008/6/21/build-your-own-amqp-client.html
83
-
84
- Dmitriy Samovskiy introduces Ruby + QPid + RabbitMQ
85
- http://somic-org.homelinux.org/blog/2008/06/24/ruby-amqp-rabbitmq-example/
86
-
87
- Ben Hood's as3-amqp
88
- http://github.com/0x6e6562/as3-amqp
89
- http://hopper.squarespace.com/blog/2008/7/4/server-side-as3.html
90
- http://hopper.squarespace.com/blog/2008/3/24/as3-amqp-client-first-cut.html
91
-
92
- RabbitMQ's protocol code generator
93
- http://hg.rabbitmq.com/rabbitmq-codegen/
94
-
95
- Erlang Exchange presentation on the implementation of RabbitMQ
96
- http://skillsmatter.com/podcast/erlang/presenting-rabbitmq-an-erlang-based-implementatio-nof-amqp
97
- http://www.lshift.net/blog/2008/07/01/slides-from-our-erlang-exchange-talk
98
-
99
- Jonathan Conway's series on RabbitMQ and using it with Ruby/Merb
100
- http://jaikoo.com/2008/3/20/daemonize-rabbitmq
101
- http://jaikoo.com/2008/3/14/oh-hai-rabbitmq
102
- http://jaikoo.com/2008/2/29/friday-round-up-2008-02-29
103
- http://jaikoo.com/2007/9/4/didn-t-you-get-the-memo
104
-
105
- Open Enterprise's series on messaging middleware and AMQP
106
- http://www1.interopsystems.com/analysis/can-amqp-break-ibms-mom-monopoly-part-1.html
107
- http://www1.interopsystems.com/analysis/can-amqp-break-ibms-mom-monopoly-part-2.html
108
- http://www1.interopsystems.com/analysis/can-amqp-break-ibms-mom-monopoly-part-3.html
109
-
110
- Messaging and distributed systems resources:
111
-
112
- A Critique of the Remote Procedure Call Paradigm
113
- http://www.cs.vu.nl/~ast/publications/euteco-1988.pdf
114
-
115
- A Note on Distributed Computing
116
- http://research.sun.com/techrep/1994/smli_tr-94-29.pdf
117
-
118
- Convenience Over Correctness
119
- http://steve.vinoski.net/pdf/IEEE-Convenience_Over_Correctness.pdf
120
-
121
- Metaprotocol Taxonomy and Communications Patterns
122
- http://hessian.caucho.com/doc/metaprotocol-taxonomy.xtp
123
-
124
- Joe Armstrong on Erlang messaging vs RPC
125
- http://armstrongonsoftware.blogspot.com/2008/05/road-we-didnt-go-down.html
126
-
127
- SEDA: scalable internet services using message queues
128
- http://www.eecs.harvard.edu/~mdw/papers/seda-sosp01.pdf