amqp 0.7.5 → 0.8.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -4
- data/.travis.yml +3 -5
- data/.yardopts +6 -0
- data/CHANGELOG +26 -7
- data/Gemfile +15 -7
- data/README.textile +216 -0
- data/Rakefile +0 -6
- data/amqp.gemspec +14 -4
- data/bin/jenkins.sh +27 -0
- data/bin/set_test_suite_realms_up.sh +16 -2
- data/docs/VendorSpecificExtensions.textile +32 -0
- data/examples/extensions/rabbitmq/publisher_confirmations_with_transient_messages.rb +53 -0
- data/examples/hello_world.rb +29 -0
- data/examples/real-world/task-queue/README.textile +3 -0
- data/examples/real-world/task-queue/consumer.rb +27 -0
- data/examples/real-world/task-queue/producer.rb +22 -0
- data/examples/various/ack.rb +70 -0
- data/examples/various/automatic_binding_for_default_direct_exchange.rb +53 -0
- data/examples/various/basic_get.rb +65 -0
- data/examples/various/callbacks.rb +45 -0
- data/examples/various/clock.rb +74 -0
- data/examples/various/declare_a_queue_without_assignment.rb +46 -0
- data/examples/various/declare_an_exchange_without_assignment.rb +46 -0
- data/examples/various/hashtable.rb +60 -0
- data/examples/{logger.rb → various/logger.rb} +9 -7
- data/examples/{multiclock.rb → various/multiclock.rb} +15 -17
- data/examples/various/open_channel_without_assignment.rb +34 -0
- data/examples/various/pingpong.rb +53 -0
- data/examples/various/primes-simple.rb +29 -0
- data/examples/various/primes.rb +76 -0
- data/examples/various/pubsub.rb +43 -0
- data/examples/various/queue_status.rb +58 -0
- data/examples/various/stocks.rb +59 -0
- data/examples/various/weather_updates.rb +63 -0
- data/lib/amqp.rb +11 -2
- data/lib/amqp/basic_client.rb +23 -54
- data/lib/amqp/channel.rb +577 -805
- data/lib/amqp/client.rb +37 -275
- data/lib/amqp/connection.rb +165 -93
- data/lib/amqp/deprecated/fork.rb +15 -0
- data/lib/amqp/deprecated/logger.rb +99 -0
- data/lib/amqp/deprecated/mq.rb +20 -0
- data/lib/amqp/deprecated/rpc.rb +168 -0
- data/lib/amqp/exchange.rb +409 -281
- data/lib/amqp/extensions/rabbitmq.rb +1 -0
- data/lib/amqp/header.rb +41 -17
- data/lib/amqp/logger.rb +10 -84
- data/lib/amqp/queue.rb +457 -320
- data/lib/amqp/rpc.rb +11 -107
- data/lib/amqp/version.rb +1 -1
- data/lib/mq.rb +2 -1
- data/lib/mq/logger.rb +2 -0
- data/lib/mq/rpc.rb +2 -0
- data/spec/integration/authentication_spec.rb +36 -40
- data/spec/integration/automatic_binding_for_default_direct_exchange_spec.rb +3 -5
- data/spec/integration/basic_get_spec.rb +91 -0
- data/spec/integration/channel_close_spec.rb +5 -5
- data/spec/integration/exchange_declaration_spec.rb +6 -53
- data/spec/integration/extensions/basic_return_spec.rb +47 -0
- data/spec/integration/queue_declaration_spec.rb +14 -17
- data/spec/integration/queue_exclusivity_spec.rb +49 -48
- data/spec/integration/reply_queue_communication_spec.rb +6 -4
- data/spec/integration/store_and_forward_spec.rb +9 -36
- data/spec/integration/topic_subscription_spec.rb +1 -1
- data/spec/integration/workload_distribution_spec.rb +1 -0
- data/spec/spec_helper.rb +69 -43
- data/spec/unit/amqp/connection_spec.rb +27 -23
- data/tasks.rb +11 -0
- metadata +124 -95
- data/README.md +0 -156
- data/TODO +0 -30
- data/amqp.pre.gemspec +0 -6
- data/examples/ack.rb +0 -47
- data/examples/automatic_binding_for_default_direct_exchange.rb +0 -65
- data/examples/callbacks.rb +0 -40
- data/examples/clock.rb +0 -65
- data/examples/default_channel.rb +0 -19
- data/examples/hashtable.rb +0 -61
- data/examples/immediately_bind_a_server_named_queue.rb +0 -38
- data/examples/internal.rb +0 -51
- data/examples/issues/issue_75.rb +0 -21
- data/examples/issues/issue_94.rb +0 -23
- data/examples/pingpong.rb +0 -54
- data/examples/pop.rb +0 -45
- data/examples/primes-simple.rb +0 -21
- data/examples/primes.rb +0 -101
- data/examples/simple.rb +0 -81
- data/examples/stocks.rb +0 -67
- data/gemfiles/eventmachine-pre +0 -24
- data/lib/amqp/buffer.rb +0 -272
- data/lib/amqp/collection.rb +0 -60
- data/lib/amqp/frame.rb +0 -68
- data/lib/amqp/protocol.rb +0 -163
- data/lib/amqp/server.rb +0 -101
- data/lib/amqp/spec.rb +0 -832
- data/protocol/amqp-0.8.json +0 -617
- data/protocol/amqp-0.8.xml +0 -3908
- data/protocol/codegen.rb +0 -175
- data/protocol/doc.txt +0 -281
- data/research/api.rb +0 -52
- data/research/primes-forked.rb +0 -65
- data/research/primes-processes.rb +0 -137
- data/research/primes-threaded.rb +0 -51
- data/spec/integration/queue_status_spec.rb +0 -44
- data/spec/unit/amqp/buffer_spec.rb +0 -178
- data/spec/unit/amqp/client_spec.rb +0 -102
- data/spec/unit/amqp/collection_spec.rb +0 -144
- data/spec/unit/amqp/frame_spec.rb +0 -60
- data/spec/unit/amqp/protocol_spec.rb +0 -51
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/.yardopts
ADDED
data/CHANGELOG
CHANGED
@@ -1,15 +1,34 @@
|
|
1
|
-
= Version 0.
|
1
|
+
= Version 0.8.0
|
2
2
|
|
3
|
-
* [
|
4
|
-
|
5
|
-
* [
|
3
|
+
* [API] AMQP::Channel.new now accepts (an optional) block and yields newly opened channel to it as soon as
|
4
|
+
channel.open-ok arrives from the broker.
|
5
|
+
* [API] AMQP::Header#ack now can acknowledge multiple deliveries
|
6
|
+
* [API] AMQP::Exchange#delete now takes (an optional) block that is called when exchange.delete-ok response arrives.
|
7
|
+
* [API] AMQP::Header now implements #to_hash
|
8
|
+
* [API] AMQP::Queue#pop block now can take 1, 2 or 7 (that's right) arguments.
|
9
|
+
1 argument means handler is only interested in content payload
|
10
|
+
2 arguments means handler is interested in headers and the content
|
11
|
+
7 arguments means handlers wants all the properties get-ok (or get-empty) carries
|
12
|
+
* [API] AMQP::Queue#purge now takes an optional block which is called when queue.purge-ok response arrives.
|
13
|
+
* [API] AMQP::Queue#delete now takes an optional block which is called when queue.delete-ok response arrives.
|
14
|
+
* [API] AMQP::Queue#delete now accepts :nowait option.
|
15
|
+
* [API] AMQP::Queue#unbind now takes an optional block which is called when queue.unbind-ok response arrives.
|
16
|
+
* [API] AMQP::Queue#unbind now accepts :routing_key as alias to :key. we believe it is a good idea to use AMQP terms.
|
17
|
+
* [API] AMQP::Channel#prefetch now takes (an optional) 2nd parameter that specifies
|
18
|
+
that QoS settings should be applied to underlying connection, as well as optional callback.
|
19
|
+
* [API] AMQP::Channel#recover now takes (an optional) callback that is called when
|
20
|
+
basic.recover-ok is received.
|
21
|
+
* [API] AMQP::Frame is gone.
|
22
|
+
* [API] AMQP::Buffer is gone. Serialization & framing are now handled primarily by amq-protocol.
|
23
|
+
* [FEATURE] AMQP gem is now AMQP 0.9.1 compatible: it runs atop of amq-client gem
|
24
|
+
* [API] AMQP::Queue#publish is deprecated.
|
25
|
+
* [API] Name argument for AMQP::Queue.new and Channel#queue is optional.
|
6
26
|
|
7
27
|
= Version 0.7.1
|
8
28
|
|
9
29
|
* [BUG] AMQP gem no longer conflicts with Builder 2.1.2 on Ruby 1.9.
|
10
|
-
|
11
|
-
|
12
|
-
|
30
|
+
All Ruby on Rails 3 users who run Ruby 1.9 are highly recommended
|
31
|
+
to upgrade!
|
13
32
|
* [API] AMQP::Exchange.default no longer caches exchange object between calls
|
14
33
|
because it may lead to very obscure issues when channel that exchange was
|
15
34
|
using is closed (due to connection loss, as part of test suite teardown
|
data/Gemfile
CHANGED
@@ -1,24 +1,32 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
source
|
3
|
+
source "http://gemcutter.org"
|
4
4
|
|
5
5
|
# Use local clones if possible.
|
6
|
-
# If you want to use your local copy, just symlink it to vendor.
|
7
6
|
def custom_gem(name, options = Hash.new)
|
8
|
-
local_path = File.expand_path("
|
9
|
-
if File.
|
7
|
+
local_path = File.expand_path("../../#{name}", __FILE__)
|
8
|
+
if ENV["USE_AMQP_CUSTOM_GEMS"] && File.directory?(local_path)
|
10
9
|
gem name, options.merge(:path => local_path).delete_if { |key, _| [:git, :branch].include?(key) }
|
11
10
|
else
|
12
11
|
gem name, options
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
16
|
-
|
17
15
|
gem "eventmachine"
|
16
|
+
gem "json", :platform => :ruby_18
|
17
|
+
custom_gem "amq-client", :git => "git://github.com/ruby-amqp/amq-client.git", :branch => "master"
|
18
|
+
custom_gem "amq-protocol", :git => "git://github.com/ruby-amqp/amq-protocol.git", :branch => "master"
|
19
|
+
|
20
|
+
group(:development) do
|
21
|
+
gem "yard"
|
22
|
+
# yard tags this buddy along
|
23
|
+
gem "RedCloth"
|
24
|
+
|
25
|
+
custom_gem "nake", :platform => :ruby_19
|
26
|
+
custom_gem "contributors", :platform => :ruby_19
|
27
|
+
end
|
18
28
|
|
19
29
|
group(:test) do
|
20
30
|
gem "rspec", ">=2.0.0"
|
21
|
-
gem "rake"
|
22
|
-
# gem "amqp-spec", :git => "git://github.com/ruby-amqp/amqp-spec.git", :branch => "master"
|
23
31
|
custom_gem "evented-spec", :git => "git://github.com/ruby-amqp/evented-spec.git", :branch => "master"
|
24
32
|
end
|
data/README.textile
ADDED
@@ -0,0 +1,216 @@
|
|
1
|
+
h1. About amqp gem "!http://travis-ci.org/ruby-amqp/amqp.png!":http://travis-ci.org/ruby-amqp/amqp
|
2
|
+
|
3
|
+
amqp gem is a widely used, feature-rich asynchronous Ruby AMQP client built on top of "EventMachine":http://rubyeventmachine.com.
|
4
|
+
This library works with Ruby 1.8.7, Ruby 1.9.2, JRuby, REE and Rubinius, and is
|
5
|
+
licensed under the "Ruby License":http://www.ruby-lang.org/en/LICENSE.txt.
|
6
|
+
Versions 0.8.0 and later of amqp gem implement "AMQP 0.9.1":http://bit.ly/hw2ELX.
|
7
|
+
|
8
|
+
|
9
|
+
h2. What is AMQP?
|
10
|
+
|
11
|
+
AMQP is an "open standard for messaging middleware":http://www.amqp.org/confluence/display/AMQP/About+AMQP that
|
12
|
+
emphasizes interoperability between different technologies (for example, Java, .NET,
|
13
|
+
Ruby, Python, C and so on).
|
14
|
+
|
15
|
+
Key features of AMQP are very flexible yet simple routing and binary protocol
|
16
|
+
efficiency.
|
17
|
+
|
18
|
+
|
19
|
+
h2. What is amqp gem good for?
|
20
|
+
|
21
|
+
One can use amqp gem to make Ruby applications interoperate with other
|
22
|
+
applications (both Ruby and not). Complexity and size may vary from
|
23
|
+
simple work queues to complex multi-stage data processing workflows that involve
|
24
|
+
dozens or hundreds of applications built with all kinds of technologies.
|
25
|
+
|
26
|
+
Specific examples:
|
27
|
+
|
28
|
+
* A Web application may route messages to a Java app that works
|
29
|
+
with SMS delivery gateways.
|
30
|
+
|
31
|
+
* Periodically run (Cron-driven) application may notify other systems that
|
32
|
+
there are some new results.
|
33
|
+
|
34
|
+
* Content aggregators may update full-text search and geospatial search indexes
|
35
|
+
by delegating actual indexing work to other applications over AMQP.
|
36
|
+
|
37
|
+
* Companies may provide "Firehose-like" push APIs to their customers, partners
|
38
|
+
or just general public.
|
39
|
+
|
40
|
+
* A new shiny Ruby-based system may be integrated with an existing C++-based component
|
41
|
+
using AMQP.
|
42
|
+
|
43
|
+
* An application that watches updates from a real-time stream (be it markets data
|
44
|
+
or Twitter stream) can propagate updates to interested parties, including
|
45
|
+
Web applications that display that information in the real time.
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
h2. Getting started with amqp gem
|
50
|
+
|
51
|
+
h3. Install RabbitMQ
|
52
|
+
|
53
|
+
Please refer to "RabbitMQ installation guide":http://www.rabbitmq.com/install.html
|
54
|
+
Note that for Ubuntu and Debian we strongly advice that you use "RabbitMQ apt repository":http://www.rabbitmq.com/debian.html#apt
|
55
|
+
that has recent versions of RabbitMQ. Ubuntu (even 10.10) and Debian both "ship with old RabbitMQ version":http://packages.ubuntu.com/maverick/rabbitmq-server,
|
56
|
+
that only supports AMQP protocol 0.8. amqp gem 0.8.0 and later *will not work with RabbitMQ versions
|
57
|
+
before 2.0*.
|
58
|
+
|
59
|
+
|
60
|
+
h3. Install the gem
|
61
|
+
|
62
|
+
<pre>gem install amqp</pre>
|
63
|
+
|
64
|
+
|
65
|
+
h3. "Hello, World" example
|
66
|
+
|
67
|
+
<pre>
|
68
|
+
#!/usr/bin/env ruby
|
69
|
+
# encoding: utf-8
|
70
|
+
|
71
|
+
require "rubygems"
|
72
|
+
require 'amqp'
|
73
|
+
|
74
|
+
EventMachine.run do
|
75
|
+
AMQP.connect(:host => 'localhost') do |connection|
|
76
|
+
puts "Connected to AMQP broker"
|
77
|
+
|
78
|
+
channel = AMQP::Channel.new(connection)
|
79
|
+
queue = channel.queue("amqpgem.examples.hello_world")
|
80
|
+
exchange = channel.default_exchange
|
81
|
+
|
82
|
+
queue.subscribe do |payload|
|
83
|
+
puts "Received a message: #{payload}. Disconnecting..."
|
84
|
+
|
85
|
+
connection.close {
|
86
|
+
EM.stop { exit }
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
exchange.publish "Hello, world!", :routing_key => queue.name
|
91
|
+
end
|
92
|
+
end
|
93
|
+
</pre>
|
94
|
+
|
95
|
+
(see "as a Gist":https://gist.github.com/910211)
|
96
|
+
|
97
|
+
|
98
|
+
h2. How to use AMQP gem with Ruby on Rails, Merb, Sinatra and other web frameworks
|
99
|
+
|
100
|
+
To use AMQP gem from web applications, you would need to have EventMachine reactor running.
|
101
|
+
If you use "Thin":http://code.macournoyer.com/thin/ or "Goliath":https://github.com/postrank-labs/goliath/,
|
102
|
+
you are all set: those two servers use EventMachine under the hood.
|
103
|
+
|
104
|
+
With other web servers, you need to start EventMachine reactor in a separate thread like this:
|
105
|
+
|
106
|
+
<pre>Thread.new { EM.run }</pre>
|
107
|
+
|
108
|
+
Otherwise EventMachine will block current thread.
|
109
|
+
|
110
|
+
|
111
|
+
Then connect to AMQP broker:
|
112
|
+
|
113
|
+
<pre>amqp_connection = AMQP.connect(:host => "localhost", :user => "guest", :pass => "guest", :vhost => "/")</pre>
|
114
|
+
|
115
|
+
In a Ruby on Rails app, probably the best place for this code is initializer
|
116
|
+
(like config/initializers/amqp.rb). For Merb apps, it is config/init.rb. For
|
117
|
+
Sinatra and pure Rack applications, place it next to other configuration
|
118
|
+
code.
|
119
|
+
|
120
|
+
If you want to integrate AMQP with "Thin":http://code.macournoyer.com/thin/, "Goliath":https://github.com/postrank-labs/goliath/ or
|
121
|
+
some other EventMachine-based software which already runs an event loop, you might want to use following code:
|
122
|
+
|
123
|
+
<pre>EM.next_tick { AMQP.connect(...) }</pre>
|
124
|
+
|
125
|
+
So in case EventMachine reactor isn't running yet on server/application boot,
|
126
|
+
connection won't fail but instead wait for reactor to start.
|
127
|
+
|
128
|
+
Same separate thread technique can be used to make EventMachine play nicely with other
|
129
|
+
libraries that would block current thread (like "File::Tail":http://rubygems.org/gems/file-tail).
|
130
|
+
|
131
|
+
|
132
|
+
h2. Using amqp gem in your app/library using Bundler
|
133
|
+
|
134
|
+
With Bundler, add this line to your Gemfile:
|
135
|
+
|
136
|
+
<pre>gem "amqp"</pre>
|
137
|
+
|
138
|
+
If you want to use edge version (usually there is no need to):
|
139
|
+
|
140
|
+
<pre>
|
141
|
+
gem "amqp", :git => "git://github.com/ruby-amqp/amqp.git", :branch => "master"
|
142
|
+
</pre>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
h2. Examples
|
147
|
+
|
148
|
+
You can find many examples (both real-world cases and simple demonstrations)
|
149
|
+
"under examples directory":https://github.com/ruby-amqp/amqp/tree/master/examples in the repository.
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
h2. How does amqp gem relate to amq-client gem, amq-protocol and libraries like bunny?
|
154
|
+
|
155
|
+
See "this page about AMQP gems family":https://github.com/ruby-amqp/amq-client/blob/master/README.textile
|
156
|
+
|
157
|
+
|
158
|
+
h2. How can I learn more?
|
159
|
+
|
160
|
+
h3. AMQP resources
|
161
|
+
|
162
|
+
* "RabbitMQ tutorials":http://www.rabbitmq.com/getstarted.html that demonstrate interoperability
|
163
|
+
* "Wikipedia page on AMQP":http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol
|
164
|
+
* "AMQP quick reference":http://www.rabbitmq.com/amqp-0-9-1-quickref.html
|
165
|
+
* John O'Hara on the "history of AMQP":http://www.acmqueue.org/modules.php?name=Content&pa=showpage&pid=485
|
166
|
+
|
167
|
+
h3. Messaging and distributed systems resources
|
168
|
+
|
169
|
+
* "Enterprise Integration Patterns":http://www.eaipatterns.com/, a book about messaging and use of messaging in systems integration.
|
170
|
+
|
171
|
+
* "A Critique of the Remote Procedure Call Paradigm":http://www.cs.vu.nl/~ast/publications/euteco-1988.pdf
|
172
|
+
* "A Note on Distributed Computing":http://research.sun.com/techrep/1994/smli_tr-94-29.pdf
|
173
|
+
* "Convenience Over Correctness":http://steve.vinoski.net/pdf/IEEE-Convenience_Over_Correctness.pdf
|
174
|
+
* Joe Armstrong on "Erlang messaging vs RPC":http://armstrongonsoftware.blogspot.com/2008/05/road-we-didnt-go-down.html
|
175
|
+
|
176
|
+
|
177
|
+
h2. Community
|
178
|
+
|
179
|
+
* "Ruby AMQP mailing list":http://groups.google.com/group/ruby-amqp
|
180
|
+
* "RabbitMQ mailing list":https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss (AMQP community epicenter).
|
181
|
+
* "Jabber room for contributors":xmpp://amqp-dev@conf.netlab.cz
|
182
|
+
|
183
|
+
|
184
|
+
h2. License
|
185
|
+
|
186
|
+
AMQP gem is licensed under the "Ruby License:"http://www.ruby-lang.org/en/LICENSE.txt.
|
187
|
+
|
188
|
+
|
189
|
+
h2. Credits and copyright information
|
190
|
+
|
191
|
+
* The Original Code is "tmm1/amqp":http://github.com/tmm1/amqp.
|
192
|
+
* The Initial Developer of the Original Code is Aman Gupta.
|
193
|
+
* Copyright (c) 2008 - 2010 "Aman Gupta":http://github.com/tmm1.
|
194
|
+
* Contributions from "Jakub Stastny":http://github.com/botanicus are Copyright (c) 2011 VMware, Inc.
|
195
|
+
* Copyright (c) 2010 — 2011 "ruby-amqp":https://github.com/ruby-amqp group members.
|
196
|
+
|
197
|
+
Currently maintained by "ruby-amqp":https://github.com/ruby-amqp group members
|
198
|
+
Special thanks to Dmitriy Samovskiy, Ben Hood and Tony Garnock-Jones.
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
h2. FAQ
|
203
|
+
|
204
|
+
h3. So, does amqp gem only work with RabbitMQ?
|
205
|
+
|
206
|
+
This library was tested primarily with "RabbitMQ":http://rabbitmq.com, although it should be compatible with any
|
207
|
+
server implementing the "AMQP 0.9.1 spec":http://bit.ly/hw2ELX. For AMQP 0.8.0 brokers,
|
208
|
+
use version 0.7.
|
209
|
+
|
210
|
+
|
211
|
+
h2. Links
|
212
|
+
|
213
|
+
* "API Documentation":http://rdoc.info/github/ruby-amqp/amq-protocol/master/frames
|
214
|
+
* "Examples":https://github.com/ruby-amqp/amq-protocol/tree/master/examples/
|
215
|
+
* "Issue tracker":http://github.com/ruby-amqp/amq-protocol/issues
|
216
|
+
* "Continous integration server":http://travis-ci.org/#!/ruby-amqp/amqp
|
data/Rakefile
CHANGED
@@ -1,14 +1,8 @@
|
|
1
|
-
require 'fileutils'
|
2
1
|
require 'rspec/core/rake_task'
|
3
2
|
|
4
3
|
desc "Run spec suite (uses Rspec2)"
|
5
4
|
RSpec::Core::RakeTask.new(:spec) { |t|}
|
6
5
|
|
7
|
-
namespace :spec do
|
8
|
-
desc "Clean up rbx compiled files and run spec suite"
|
9
|
-
RSpec::Core::RakeTask.new(:ci) { |t| Dir.glob("**/*.rbc").each {|f| FileUtils.rm_f(f) } }
|
10
|
-
end
|
11
|
-
|
12
6
|
desc "Run specs with RCov"
|
13
7
|
RSpec::Core::RakeTask.new(:rcov) do |t|
|
14
8
|
t.rcov = true
|
data/amqp.gemspec
CHANGED
@@ -11,18 +11,28 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.homepage = "http://github.com/ruby-amqp/amqp"
|
12
12
|
s.summary = "AMQP client implementation in Ruby/EventMachine."
|
13
13
|
s.description = "Asynchronous AMQP 0.9.1 client for Ruby. Built on top of Eventmachine."
|
14
|
+
s.cert_chain = nil
|
14
15
|
s.email = ["bWljaGFlbEBub3ZlbWJlcmFpbi5jb20=\n", "c3Rhc3RueUAxMDFpZGVhcy5jeg==\n"].map { |i| Base64.decode64(i) }
|
15
16
|
|
16
17
|
# files
|
17
|
-
s.files = `git ls-files`.split("\n")
|
18
|
+
s.files = `git ls-files`.split("\n").reject { |file| file =~ /^vendor\// }
|
18
19
|
s.require_paths = ["lib"]
|
19
20
|
|
20
21
|
# RDoc
|
21
|
-
s.
|
22
|
-
s.
|
22
|
+
s.has_rdoc = true
|
23
|
+
s.rdoc_options = '--include=examples --main README.textile'
|
24
|
+
s.extra_rdoc_files = ["README.textile"] + Dir.glob("doc/*")
|
23
25
|
|
24
26
|
# Dependencies
|
25
|
-
s.add_dependency "eventmachine"
|
27
|
+
s.add_dependency "eventmachine", "~> 0.12.10"
|
28
|
+
s.add_dependency "amq-client"
|
29
|
+
|
30
|
+
begin
|
31
|
+
require "changelog"
|
32
|
+
s.post_install_message = CHANGELOG.new.version_changes
|
33
|
+
rescue LoadError
|
34
|
+
# warn "You have to have changelog gem installed for post install message"
|
35
|
+
end
|
26
36
|
|
27
37
|
# RubyForge
|
28
38
|
s.rubyforge_project = "amqp"
|
data/bin/jenkins.sh
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
echo -e "\n\n==== Setup ===="
|
4
|
+
source /etc/profile
|
5
|
+
git fetch && git reset origin/master --hard
|
6
|
+
|
7
|
+
# FIXME: Jenkins user doesn't have permissions to run it.
|
8
|
+
# PATH=/usr/sbin:$PATH ./bin/set_test_suite_realms_up.sh
|
9
|
+
echo "~ NOT running ./bin/set_test_suite_realms_up.sh"
|
10
|
+
|
11
|
+
echo -e "\n\n==== Ruby 1.9.2 Head ===="
|
12
|
+
rvm use 1.9.2-head@ruby-amqp
|
13
|
+
gem install bundler --no-ri --no-rdoc
|
14
|
+
bundle install --path vendor/bundle/1.9.2 --without development; echo
|
15
|
+
bundle update; echo
|
16
|
+
bundle exec rspec spec
|
17
|
+
return_status=$?
|
18
|
+
|
19
|
+
echo -e "\n\n==== Ruby 1.8.7 ===="
|
20
|
+
rvm use 1.8.7@ruby-amqp
|
21
|
+
gem install bundler --no-ri --no-rdoc
|
22
|
+
bundle install --path vendor/bundle/1.8.7 --without development; echo
|
23
|
+
bundle update; echo
|
24
|
+
bundle exec rspec spec
|
25
|
+
return_status=$(expr $return_status + $?)
|
26
|
+
|
27
|
+
test $return_status -eq 0
|
@@ -1,7 +1,21 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
|
3
|
-
# guest:guest has full access to /
|
3
|
+
# guest:guest has full access to /
|
4
4
|
|
5
|
-
rabbitmqctl add_vhost /
|
5
|
+
rabbitmqctl add_vhost /
|
6
6
|
rabbitmqctl add_user guest guest
|
7
7
|
rabbitmqctl set_permissions -p / guest ".*" ".*" ".*"
|
8
|
+
|
9
|
+
|
10
|
+
# amqp_gem:amqp_gem_password has full access to /amqp_gem_testbed
|
11
|
+
|
12
|
+
rabbitmqctl add_vhost /amqp_gem_testbed
|
13
|
+
rabbitmqctl add_user amqp_gem amqp_gem_password
|
14
|
+
rabbitmqctl set_permissions -p /amqp_gem_testbed amqp_gem ".*" ".*" ".*"
|
15
|
+
|
16
|
+
|
17
|
+
# amqp_gem_reader:reader_password has read access to /amqp_gem_testbed
|
18
|
+
|
19
|
+
rabbitmqctl add_user amqp_gem_reader reader_password
|
20
|
+
rabbitmqctl clear_permissions -p /amqp_gem_testbed guest
|
21
|
+
rabbitmqctl set_permissions -p /amqp_gem_testbed amqp_gem_reader "^---$" "^---$" ".*"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
h1. Vendor-specific AMQP extensions support in amqp gem
|
2
|
+
|
3
|
+
h2. RabbitMQ extensions
|
4
|
+
|
5
|
+
h3. Supported extensions
|
6
|
+
|
7
|
+
AMQP gem supports two "RabbitMQ extensions to AMQP 0.9.1":
|
8
|
+
|
9
|
+
* "Publisher confirmations":http://www.rabbitmq.com/extensions.html#confirms (confirm.* class)
|
10
|
+
* "Negative acknowledgements":http://www.rabbitmq.com/extensions.html#negative-acknowledgements (basic.nack)
|
11
|
+
|
12
|
+
h3. Enabling RabbitMQ extensions
|
13
|
+
|
14
|
+
If you are using RabbitMQ as AMQP broker and want to use these extensions, simply replace
|
15
|
+
|
16
|
+
<pre>require "amqp"</pre>
|
17
|
+
|
18
|
+
with
|
19
|
+
|
20
|
+
<pre>
|
21
|
+
require "amqp"
|
22
|
+
require "amqp/extensions/rabbitmq"
|
23
|
+
</pre>
|
24
|
+
|
25
|
+
h3. Example of using publisher confirmations
|
26
|
+
|
27
|
+
<script src="https://gist.github.com/923599.js?file=rabbitmq_publisher_confirmations_with_amqp_gem_0.8.0.rb"></script>
|
28
|
+
|
29
|
+
|
30
|
+
h3. Documentation
|
31
|
+
|
32
|
+
RabbitMQ extensions documentation is part of "amq-client gem documentation":http://rubydoc.info/github/ruby-amqp/amq-client/master/frames
|