sparqcode_bunny 0.0.1
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.
- data/.gitignore +10 -0
- data/.rspec +3 -0
- data/.travis.yml +15 -0
- data/.yardopts +9 -0
- data/CHANGELOG +27 -0
- data/Gemfile +39 -0
- data/LICENSE +21 -0
- data/README.textile +82 -0
- data/Rakefile +14 -0
- data/bunny.gemspec +43 -0
- data/examples/simple_08.rb +32 -0
- data/examples/simple_09.rb +32 -0
- data/examples/simple_ack_08.rb +35 -0
- data/examples/simple_ack_09.rb +35 -0
- data/examples/simple_consumer_08.rb +55 -0
- data/examples/simple_consumer_09.rb +55 -0
- data/examples/simple_fanout_08.rb +41 -0
- data/examples/simple_fanout_09.rb +41 -0
- data/examples/simple_headers_08.rb +42 -0
- data/examples/simple_headers_09.rb +42 -0
- data/examples/simple_publisher_08.rb +29 -0
- data/examples/simple_publisher_09.rb +29 -0
- data/examples/simple_topic_08.rb +61 -0
- data/examples/simple_topic_09.rb +61 -0
- data/ext/amqp-0.8.json +616 -0
- data/ext/amqp-0.9.1.json +388 -0
- data/ext/config.yml +4 -0
- data/ext/qparser.rb +469 -0
- data/lib/bunny/channel08.rb +39 -0
- data/lib/bunny/channel09.rb +39 -0
- data/lib/bunny/client08.rb +472 -0
- data/lib/bunny/client09.rb +374 -0
- data/lib/bunny/consumer.rb +35 -0
- data/lib/bunny/exchange08.rb +171 -0
- data/lib/bunny/exchange09.rb +159 -0
- data/lib/bunny/queue08.rb +403 -0
- data/lib/bunny/queue09.rb +325 -0
- data/lib/bunny/subscription08.rb +87 -0
- data/lib/bunny/subscription09.rb +87 -0
- data/lib/bunny/system_timer.rb +14 -0
- data/lib/bunny/version.rb +5 -0
- data/lib/bunny.rb +109 -0
- data/lib/qrack/amq-client-url.rb +165 -0
- data/lib/qrack/channel.rb +20 -0
- data/lib/qrack/client.rb +235 -0
- data/lib/qrack/errors.rb +5 -0
- data/lib/qrack/protocol/protocol08.rb +134 -0
- data/lib/qrack/protocol/protocol09.rb +135 -0
- data/lib/qrack/protocol/spec08.rb +828 -0
- data/lib/qrack/protocol/spec09.rb +524 -0
- data/lib/qrack/qrack08.rb +20 -0
- data/lib/qrack/qrack09.rb +20 -0
- data/lib/qrack/queue.rb +40 -0
- data/lib/qrack/subscription.rb +112 -0
- data/lib/qrack/transport/buffer08.rb +278 -0
- data/lib/qrack/transport/buffer09.rb +280 -0
- data/lib/qrack/transport/frame08.rb +117 -0
- data/lib/qrack/transport/frame09.rb +97 -0
- data/spec/spec_08/bunny_spec.rb +77 -0
- data/spec/spec_08/connection_spec.rb +25 -0
- data/spec/spec_08/exchange_spec.rb +173 -0
- data/spec/spec_08/queue_spec.rb +235 -0
- data/spec/spec_09/amqp_url_spec.rb +19 -0
- data/spec/spec_09/bunny_spec.rb +76 -0
- data/spec/spec_09/connection_spec.rb +29 -0
- data/spec/spec_09/exchange_spec.rb +173 -0
- data/spec/spec_09/queue_spec.rb +248 -0
- metadata +151 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# connection_spec.rb
|
4
|
+
|
5
|
+
require "bunny"
|
6
|
+
|
7
|
+
describe Bunny do
|
8
|
+
|
9
|
+
it "should raise an error if the wrong user name or password is used" do
|
10
|
+
b = Bunny.new(:spec => '0.9', :user => 'wrong')
|
11
|
+
lambda { b.start}.should raise_error(Bunny::ProtocolError)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should merge custom settings from AMQP URL with default settings" do
|
15
|
+
b = Bunny.new("amqp://tagadab", :spec => "0.9")
|
16
|
+
b.host.should eql("tagadab")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be able to open a TCPSocket with a timeout" do
|
20
|
+
b = Bunny.new(:spec => "0.9")
|
21
|
+
connect_timeout = 5
|
22
|
+
lambda {
|
23
|
+
Bunny::Timer::timeout(connect_timeout, Qrack::ConnectionTimeout) do
|
24
|
+
TCPSocket.new(b.host, b.port)
|
25
|
+
end
|
26
|
+
}.should_not raise_error(Exception)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,173 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# exchange_spec.rb
|
4
|
+
|
5
|
+
# Assumes that target message broker/server has a user called 'guest' with a password 'guest'
|
6
|
+
# and that it is running on 'localhost'.
|
7
|
+
|
8
|
+
# If this is not the case, please change the 'Bunny.new' call below to include
|
9
|
+
# the relevant arguments e.g. @b = Bunny.new(:user => 'john', :pass => 'doe', :host => 'foobar')
|
10
|
+
|
11
|
+
require "bunny"
|
12
|
+
|
13
|
+
describe 'Exchange' do
|
14
|
+
|
15
|
+
before(:each) do
|
16
|
+
@b = Bunny.new(:spec => '09')
|
17
|
+
@b.start
|
18
|
+
end
|
19
|
+
|
20
|
+
after(:each) do
|
21
|
+
begin
|
22
|
+
@b.stop
|
23
|
+
rescue Exception
|
24
|
+
ensure
|
25
|
+
@b = nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should raise an error if instantiated as non-existent type" do
|
30
|
+
lambda { @b.exchange('bogus_ex', :type => :bogus) }.should raise_error(Bunny::ForcedConnectionCloseError)
|
31
|
+
@b.status.should == :not_connected
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should allow a default direct exchange to be instantiated by specifying :type" do
|
35
|
+
exch = @b.exchange('amq.direct', :type => :direct)
|
36
|
+
exch.should be_an_instance_of(Bunny::Exchange09)
|
37
|
+
exch.name.should == 'amq.direct'
|
38
|
+
exch.type.should == :direct
|
39
|
+
@b.exchanges.has_key?('amq.direct').should be(true)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should allow a default direct exchange to be instantiated without specifying :type" do
|
43
|
+
exch = @b.exchange('amq.direct')
|
44
|
+
exch.should be_an_instance_of(Bunny::Exchange09)
|
45
|
+
exch.name.should == 'amq.direct'
|
46
|
+
exch.type.should == :direct
|
47
|
+
@b.exchanges.has_key?('amq.direct').should be(true)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should allow a default fanout exchange to be instantiated without specifying :type" do
|
51
|
+
exch = @b.exchange('amq.fanout')
|
52
|
+
exch.should be_an_instance_of(Bunny::Exchange09)
|
53
|
+
exch.name.should == 'amq.fanout'
|
54
|
+
exch.type.should == :fanout
|
55
|
+
@b.exchanges.has_key?('amq.fanout').should be(true)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should allow a default topic exchange to be instantiated without specifying :type" do
|
59
|
+
exch = @b.exchange('amq.topic')
|
60
|
+
exch.should be_an_instance_of(Bunny::Exchange09)
|
61
|
+
exch.name.should == 'amq.topic'
|
62
|
+
exch.type.should == :topic
|
63
|
+
@b.exchanges.has_key?('amq.topic').should be(true)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should allow a default headers (amq.match) exchange to be instantiated without specifying :type" do
|
67
|
+
exch = @b.exchange('amq.match')
|
68
|
+
exch.should be_an_instance_of(Bunny::Exchange09)
|
69
|
+
exch.name.should == 'amq.match'
|
70
|
+
exch.type.should == :headers
|
71
|
+
@b.exchanges.has_key?('amq.match').should be(true)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should allow a default headers (amq.headers) exchange to be instantiated without specifying :type" do
|
75
|
+
exch = @b.exchange('amq.headers')
|
76
|
+
exch.should be_an_instance_of(Bunny::Exchange09)
|
77
|
+
exch.name.should == 'amq.headers'
|
78
|
+
exch.type.should == :headers
|
79
|
+
@b.exchanges.has_key?('amq.headers').should be(true)
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should create an exchange as direct by default" do
|
83
|
+
exch = @b.exchange('direct_defaultex')
|
84
|
+
exch.should be_an_instance_of(Bunny::Exchange09)
|
85
|
+
exch.name.should == 'direct_defaultex'
|
86
|
+
exch.type.should == :direct
|
87
|
+
@b.exchanges.has_key?('direct_defaultex').should be(true)
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should be able to be instantiated as a direct exchange" do
|
91
|
+
exch = @b.exchange('direct_exchange', :type => :direct)
|
92
|
+
exch.should be_an_instance_of(Bunny::Exchange09)
|
93
|
+
exch.name.should == 'direct_exchange'
|
94
|
+
exch.type.should == :direct
|
95
|
+
@b.exchanges.has_key?('direct_exchange').should be(true)
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should be able to be instantiated as a topic exchange" do
|
99
|
+
exch = @b.exchange('topic_exchange', :type => :topic)
|
100
|
+
exch.should be_an_instance_of(Bunny::Exchange09)
|
101
|
+
exch.name.should == 'topic_exchange'
|
102
|
+
exch.type.should == :topic
|
103
|
+
@b.exchanges.has_key?('topic_exchange').should be(true)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should be able to be instantiated as a fanout exchange" do
|
107
|
+
exch = @b.exchange('fanout_exchange', :type => :fanout)
|
108
|
+
exch.should be_an_instance_of(Bunny::Exchange09)
|
109
|
+
exch.name.should == 'fanout_exchange'
|
110
|
+
exch.type.should == :fanout
|
111
|
+
@b.exchanges.has_key?('fanout_exchange').should be(true)
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should be able to be instantiated as a headers exchange" do
|
115
|
+
exch = @b.exchange('headers_exchange', :type => :headers)
|
116
|
+
exch.should be_an_instance_of(Bunny::Exchange09)
|
117
|
+
exch.name.should == 'headers_exchange'
|
118
|
+
exch.type.should == :headers
|
119
|
+
@b.exchanges.has_key?('headers_exchange').should be(true)
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should ignore the :nowait option when instantiated" do
|
123
|
+
exch = @b.exchange('direct2_exchange', :nowait => true)
|
124
|
+
end
|
125
|
+
|
126
|
+
it "should be able to publish a message" do
|
127
|
+
exch = @b.exchange('direct_exchange')
|
128
|
+
exch.publish('This is a published message')
|
129
|
+
end
|
130
|
+
|
131
|
+
it "should not modify the passed options hash when publishing a message" do
|
132
|
+
exch = @b.exchange('direct_exchange')
|
133
|
+
opts = {:key => 'a', :persistent => true}
|
134
|
+
exch.publish('', opts)
|
135
|
+
opts.should == {:key => 'a', :persistent => true}
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should be able to return an undeliverable message" do
|
139
|
+
exch = @b.exchange('return_exch')
|
140
|
+
exch.publish('This message should be undeliverable', :immediate => true)
|
141
|
+
ret_msg = @b.returned_message
|
142
|
+
ret_msg.should be_an_instance_of(Hash)
|
143
|
+
ret_msg[:payload].should == 'This message should be undeliverable'
|
144
|
+
end
|
145
|
+
|
146
|
+
it "should be able to return a message that exceeds maximum frame size" do
|
147
|
+
exch = @b.exchange('return_exch')
|
148
|
+
lg_msg = 'z' * 142000
|
149
|
+
exch.publish(lg_msg, :immediate => true)
|
150
|
+
ret_msg = @b.returned_message
|
151
|
+
ret_msg.should be_an_instance_of(Hash)
|
152
|
+
ret_msg[:payload].should == lg_msg
|
153
|
+
end
|
154
|
+
|
155
|
+
it "should report an error if delete fails" do
|
156
|
+
exch = @b.exchange('direct_exchange')
|
157
|
+
lambda { exch.delete(:exchange => 'bogus_ex') }.should raise_error(Bunny::ForcedChannelCloseError)
|
158
|
+
@b.channel.active.should == false
|
159
|
+
end
|
160
|
+
|
161
|
+
it "should be able to be deleted" do
|
162
|
+
exch = @b.exchange('direct_exchange')
|
163
|
+
res = exch.delete
|
164
|
+
res.should == :delete_ok
|
165
|
+
@b.exchanges.has_key?('direct_exchange').should be(false)
|
166
|
+
end
|
167
|
+
|
168
|
+
it "should ignore the :nowait option when deleted" do
|
169
|
+
exch = @b.exchange('direct2_exchange')
|
170
|
+
exch.delete(:nowait => true)
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
@@ -0,0 +1,248 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# queue_spec.rb
|
4
|
+
|
5
|
+
# Assumes that target message broker/server has a user called 'guest' with a password 'guest'
|
6
|
+
# and that it is running on 'localhost'.
|
7
|
+
|
8
|
+
# If this is not the case, please change the 'Bunny.new' call below to include
|
9
|
+
# the relevant arguments e.g. @b = Bunny.new(:user => 'john', :pass => 'doe', :host => 'foobar')
|
10
|
+
|
11
|
+
require "bunny"
|
12
|
+
|
13
|
+
describe 'Queue' do
|
14
|
+
|
15
|
+
before(:each) do
|
16
|
+
@b = Bunny.new(:spec => '09')
|
17
|
+
@b.start
|
18
|
+
|
19
|
+
@default_exchange = @b.exchange("")
|
20
|
+
end
|
21
|
+
|
22
|
+
after(:each) do
|
23
|
+
begin
|
24
|
+
@b.stop
|
25
|
+
rescue Exception
|
26
|
+
ensure
|
27
|
+
@b = nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def message_count(queue, sleep_time = 0.1)
|
32
|
+
sleep sleep_time
|
33
|
+
queue.message_count
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should ignore the :nowait option when instantiated" do
|
37
|
+
q = @b.queue('test0', :nowait => true)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should ignore the :nowait option when binding to an exchange" do
|
41
|
+
exch = @b.exchange('direct_exch')
|
42
|
+
q = @b.queue('test0')
|
43
|
+
q.bind(exch, :nowait => true).should == :bind_ok
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should raise an error when trying to bind to a non-existent exchange" do
|
47
|
+
q = @b.queue('test1')
|
48
|
+
lambda {q.bind('bogus')}.should raise_error(Bunny::ForcedChannelCloseError)
|
49
|
+
@b.channel.active.should == false
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should be able to bind to an existing exchange" do
|
53
|
+
exch = @b.exchange('direct_exch')
|
54
|
+
q = @b.queue('test1')
|
55
|
+
q.bind(exch).should == :bind_ok
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should ignore the :nowait option when unbinding from an existing exchange" do
|
59
|
+
exch = @b.exchange('direct_exch')
|
60
|
+
q = @b.queue('test0')
|
61
|
+
q.unbind(exch, :nowait => true).should == :unbind_ok
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should raise an error if unbinding from a non-existent exchange" do
|
65
|
+
q = @b.queue('test1')
|
66
|
+
lambda {q.unbind('bogus')}.should raise_error(Bunny::ForcedChannelCloseError)
|
67
|
+
@b.channel.active.should == false
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should be able to unbind from an exchange" do
|
71
|
+
exch = @b.exchange('direct_exch')
|
72
|
+
q = @b.queue('test1')
|
73
|
+
q.unbind(exch).should == :unbind_ok
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should be able to pop a message complete with header and delivery details" do
|
77
|
+
q = @b.queue('test1')
|
78
|
+
@default_exchange.publish('This is a test message', :key => 'test1')
|
79
|
+
msg = q.pop()
|
80
|
+
msg.should be_an_instance_of(Hash)
|
81
|
+
msg[:header].should be_an_instance_of(Bunny::Protocol09::Header)
|
82
|
+
msg[:payload].should == 'This is a test message'
|
83
|
+
msg[:delivery_details].should be_an_instance_of(Hash)
|
84
|
+
message_count(q).should == 0
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should be able to pop a message and just get the payload" do
|
88
|
+
q = @b.queue('test1')
|
89
|
+
@default_exchange.publish('This is another test message', :key => 'test1')
|
90
|
+
msg = q.pop[:payload]
|
91
|
+
msg.should == 'This is another test message'
|
92
|
+
message_count(q).should == 0
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should be able to pop a message where body length exceeds max frame size" do
|
96
|
+
q = @b.queue('test1')
|
97
|
+
lg_msg = 'z' * 142000
|
98
|
+
@default_exchange.publish(lg_msg, :key => 'test1')
|
99
|
+
msg = q.pop[:payload]
|
100
|
+
msg.should == lg_msg
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should be able call a block when popping a message" do
|
104
|
+
q = @b.queue('test1')
|
105
|
+
@default_exchange.publish('This is another test message', :key => 'test1')
|
106
|
+
q.pop { |msg| msg[:payload].should == 'This is another test message' }
|
107
|
+
q.pop { |msg| msg[:payload].should == :queue_empty }
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should raise an error if purge fails" do
|
111
|
+
q = @b.queue('test1')
|
112
|
+
5.times { @default_exchange.publish('This is another test message', :key => 'test1') }
|
113
|
+
message_count(q).should == 5
|
114
|
+
lambda {q.purge(:queue => 'bogus')}.should raise_error(Bunny::ForcedChannelCloseError)
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should be able to be purged to remove all of its messages" do
|
118
|
+
q = @b.queue('test1')
|
119
|
+
message_count(q).should == 5
|
120
|
+
q.purge.should == :purge_ok
|
121
|
+
message_count(q).should == 0
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should return an empty message when popping an empty queue" do
|
125
|
+
q = @b.queue('test1')
|
126
|
+
@default_exchange.publish('This is another test message', :key => 'test1')
|
127
|
+
q.pop
|
128
|
+
msg = q.pop[:payload]
|
129
|
+
msg.should == :queue_empty
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should stop subscription without processing messages if max specified is 0" do
|
133
|
+
q = @b.queue('test1')
|
134
|
+
5.times { @default_exchange.publish('Yet another test message', :key => 'test1') }
|
135
|
+
message_count(q).should == 5
|
136
|
+
q.subscribe(:message_max => 0)
|
137
|
+
message_count(q).should == 5
|
138
|
+
q.purge.should == :purge_ok
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should stop subscription after processing number of messages specified > 0" do
|
142
|
+
q = @b.queue('test1')
|
143
|
+
5.times { @default_exchange.publish('Yet another test message', :key => 'test1') }
|
144
|
+
message_count(q).should == 5
|
145
|
+
q.subscribe(:message_max => 5)
|
146
|
+
end
|
147
|
+
|
148
|
+
it "should stop subscription after processing message_max messages < total in queue" do
|
149
|
+
q = @b.queue('test1')
|
150
|
+
@b.qos()
|
151
|
+
10.times { @default_exchange.publish('Yet another test message', :key => 'test1') }
|
152
|
+
message_count(q).should == 10
|
153
|
+
q.subscribe(:message_max => 5, :ack => true)
|
154
|
+
message_count(q).should == 5
|
155
|
+
q.purge.should == :purge_ok
|
156
|
+
end
|
157
|
+
|
158
|
+
it "should stop subscription when there are no more messages to read and flag is set" do
|
159
|
+
q = @b.queue('test1')
|
160
|
+
@b.qos()
|
161
|
+
10.times { @default_exchange.publish('Yet another test message', :key => 'test1') }
|
162
|
+
message_count(q).should == 10
|
163
|
+
|
164
|
+
Timeout::timeout(5) do
|
165
|
+
q.subscribe(:ack => true, :break_when_empty => true)
|
166
|
+
message_count(q).should == 0
|
167
|
+
end
|
168
|
+
|
169
|
+
q.purge.should == :purge_ok
|
170
|
+
end
|
171
|
+
|
172
|
+
it "should stop subscription when the subscribed flag is set to false" do
|
173
|
+
q = @b.queue('test1')
|
174
|
+
@b.qos
|
175
|
+
10.times { |i| @default_exchange.publish("#{i}", :key => 'test1') }
|
176
|
+
message_count(q).should == 10
|
177
|
+
|
178
|
+
Timeout::timeout(5) do
|
179
|
+
q.subscribe(:ack => true) do |msg|
|
180
|
+
msg[:subscribed] = false if msg[:payload] == '4'
|
181
|
+
end
|
182
|
+
|
183
|
+
message_count(q).should == 5
|
184
|
+
end
|
185
|
+
|
186
|
+
q.purge.should == :purge_ok
|
187
|
+
end
|
188
|
+
|
189
|
+
it "should raise an error when delete fails" do
|
190
|
+
q = @b.queue('test1')
|
191
|
+
lambda {q.delete(:queue => 'bogus')}.should raise_error(Bunny::ForcedChannelCloseError)
|
192
|
+
@b.channel.active.should == false
|
193
|
+
end
|
194
|
+
|
195
|
+
it "should pass correct block parameters through on subscribe" do
|
196
|
+
q = @b.queue('test1')
|
197
|
+
@default_exchange.publish("messages pop'n", :key => 'test1')
|
198
|
+
|
199
|
+
q.subscribe do |msg|
|
200
|
+
msg[:header].should be_an_instance_of Qrack::Protocol09::Header
|
201
|
+
msg[:payload].should == "messages pop'n"
|
202
|
+
msg[:delivery_details].should_not be_nil
|
203
|
+
|
204
|
+
q.unsubscribe
|
205
|
+
break
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
it "should finish processing subscription messages if break is called in block" do
|
210
|
+
q = @b.queue('test1')
|
211
|
+
@default_exchange.publish('messages in my quezen', :key => 'test1')
|
212
|
+
|
213
|
+
q.subscribe do |msg|
|
214
|
+
msg[:payload].should == 'messages in my quezen'
|
215
|
+
q.unsubscribe
|
216
|
+
break
|
217
|
+
end
|
218
|
+
|
219
|
+
5.times {|i| @default_exchange.publish("#{i}", :key => 'test1') }
|
220
|
+
q.subscribe do |msg|
|
221
|
+
if msg[:payload] == '4'
|
222
|
+
q.unsubscribe
|
223
|
+
break
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
it "should be able to be deleted" do
|
229
|
+
q = @b.queue('test1')
|
230
|
+
res = q.delete
|
231
|
+
res.should == :delete_ok
|
232
|
+
@b.queues.has_key?('test1').should be(false)
|
233
|
+
end
|
234
|
+
|
235
|
+
it "should ignore the :nowait option when deleted" do
|
236
|
+
q = @b.queue('test0')
|
237
|
+
q.delete(:nowait => true)
|
238
|
+
end
|
239
|
+
|
240
|
+
it "should support server named queues" do
|
241
|
+
q = @b.queue
|
242
|
+
q.name.should_not == nil
|
243
|
+
|
244
|
+
@b.queue(q.name).should == q
|
245
|
+
q.delete
|
246
|
+
end
|
247
|
+
|
248
|
+
end
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sparqcode_bunny
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Chris Duncan
|
14
|
+
- Eric Lindvall
|
15
|
+
- Jakub Stastny aka botanicus
|
16
|
+
- Michael S. Klishin
|
17
|
+
- Stefan Kaes
|
18
|
+
autorequire:
|
19
|
+
bindir: bin
|
20
|
+
cert_chain: []
|
21
|
+
|
22
|
+
date: 2011-10-14 00:00:00 -07:00
|
23
|
+
default_executable:
|
24
|
+
dependencies: []
|
25
|
+
|
26
|
+
description: A synchronous Ruby AMQP client that enables interaction with AMQP-compliant brokers with minor modifications to make RPC easier. The official gem will be best for you 99.9973% of the time.
|
27
|
+
email:
|
28
|
+
- celldee@gmail.com
|
29
|
+
- eric@5stops.com
|
30
|
+
- stastny@101ideas.cz
|
31
|
+
- michael@novemberain.com
|
32
|
+
- skaes@railsexpress.de
|
33
|
+
executables: []
|
34
|
+
|
35
|
+
extensions: []
|
36
|
+
|
37
|
+
extra_rdoc_files:
|
38
|
+
- README.textile
|
39
|
+
files:
|
40
|
+
- .gitignore
|
41
|
+
- .rspec
|
42
|
+
- .travis.yml
|
43
|
+
- .yardopts
|
44
|
+
- CHANGELOG
|
45
|
+
- Gemfile
|
46
|
+
- LICENSE
|
47
|
+
- README.textile
|
48
|
+
- Rakefile
|
49
|
+
- bunny.gemspec
|
50
|
+
- examples/simple_08.rb
|
51
|
+
- examples/simple_09.rb
|
52
|
+
- examples/simple_ack_08.rb
|
53
|
+
- examples/simple_ack_09.rb
|
54
|
+
- examples/simple_consumer_08.rb
|
55
|
+
- examples/simple_consumer_09.rb
|
56
|
+
- examples/simple_fanout_08.rb
|
57
|
+
- examples/simple_fanout_09.rb
|
58
|
+
- examples/simple_headers_08.rb
|
59
|
+
- examples/simple_headers_09.rb
|
60
|
+
- examples/simple_publisher_08.rb
|
61
|
+
- examples/simple_publisher_09.rb
|
62
|
+
- examples/simple_topic_08.rb
|
63
|
+
- examples/simple_topic_09.rb
|
64
|
+
- ext/amqp-0.8.json
|
65
|
+
- ext/amqp-0.9.1.json
|
66
|
+
- ext/config.yml
|
67
|
+
- ext/qparser.rb
|
68
|
+
- lib/bunny.rb
|
69
|
+
- lib/bunny/channel08.rb
|
70
|
+
- lib/bunny/channel09.rb
|
71
|
+
- lib/bunny/client08.rb
|
72
|
+
- lib/bunny/client09.rb
|
73
|
+
- lib/bunny/consumer.rb
|
74
|
+
- lib/bunny/exchange08.rb
|
75
|
+
- lib/bunny/exchange09.rb
|
76
|
+
- lib/bunny/queue08.rb
|
77
|
+
- lib/bunny/queue09.rb
|
78
|
+
- lib/bunny/subscription08.rb
|
79
|
+
- lib/bunny/subscription09.rb
|
80
|
+
- lib/bunny/system_timer.rb
|
81
|
+
- lib/bunny/version.rb
|
82
|
+
- lib/qrack/amq-client-url.rb
|
83
|
+
- lib/qrack/channel.rb
|
84
|
+
- lib/qrack/client.rb
|
85
|
+
- lib/qrack/errors.rb
|
86
|
+
- lib/qrack/protocol/protocol08.rb
|
87
|
+
- lib/qrack/protocol/protocol09.rb
|
88
|
+
- lib/qrack/protocol/spec08.rb
|
89
|
+
- lib/qrack/protocol/spec09.rb
|
90
|
+
- lib/qrack/qrack08.rb
|
91
|
+
- lib/qrack/qrack09.rb
|
92
|
+
- lib/qrack/queue.rb
|
93
|
+
- lib/qrack/subscription.rb
|
94
|
+
- lib/qrack/transport/buffer08.rb
|
95
|
+
- lib/qrack/transport/buffer09.rb
|
96
|
+
- lib/qrack/transport/frame08.rb
|
97
|
+
- lib/qrack/transport/frame09.rb
|
98
|
+
- spec/spec_08/bunny_spec.rb
|
99
|
+
- spec/spec_08/connection_spec.rb
|
100
|
+
- spec/spec_08/exchange_spec.rb
|
101
|
+
- spec/spec_08/queue_spec.rb
|
102
|
+
- spec/spec_09/amqp_url_spec.rb
|
103
|
+
- spec/spec_09/bunny_spec.rb
|
104
|
+
- spec/spec_09/connection_spec.rb
|
105
|
+
- spec/spec_09/exchange_spec.rb
|
106
|
+
- spec/spec_09/queue_spec.rb
|
107
|
+
has_rdoc: true
|
108
|
+
homepage: http://github.com/sparqcode/bunny
|
109
|
+
licenses: []
|
110
|
+
|
111
|
+
post_install_message: "[\e[32mVersion 0.7.8\e[0m] test suite cleanup (eliminated some race conditions related to queue.message_count)\n"
|
112
|
+
rdoc_options:
|
113
|
+
- --main
|
114
|
+
- README.rdoc
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
hash: 3
|
123
|
+
segments:
|
124
|
+
- 0
|
125
|
+
version: "0"
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
hash: 3
|
132
|
+
segments:
|
133
|
+
- 0
|
134
|
+
version: "0"
|
135
|
+
requirements: []
|
136
|
+
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 1.5.2
|
139
|
+
signing_key:
|
140
|
+
specification_version: 3
|
141
|
+
summary: Bunny with some RPC friendly extensions
|
142
|
+
test_files:
|
143
|
+
- spec/spec_08/bunny_spec.rb
|
144
|
+
- spec/spec_08/connection_spec.rb
|
145
|
+
- spec/spec_08/exchange_spec.rb
|
146
|
+
- spec/spec_08/queue_spec.rb
|
147
|
+
- spec/spec_09/amqp_url_spec.rb
|
148
|
+
- spec/spec_09/bunny_spec.rb
|
149
|
+
- spec/spec_09/connection_spec.rb
|
150
|
+
- spec/spec_09/exchange_spec.rb
|
151
|
+
- spec/spec_09/queue_spec.rb
|