bmabey-rosetta_queue 0.2.0 → 0.3.3
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/History.txt +6 -3
- data/README.rdoc +1 -193
- data/Rakefile +7 -1
- data/cucumber.yml +1 -1
- data/examples/sample_amqp_consumer.rb +13 -3
- data/examples/sample_amqp_fanout_consumer.rb +6 -3
- data/examples/sample_amqp_fanout_producer.rb +3 -2
- data/examples/sample_amqp_producer.rb +2 -1
- data/features/filtering.feature +13 -13
- data/features/messaging.feature +28 -20
- data/features/step_definitions/common_messaging_steps.rb +54 -17
- data/features/step_definitions/filtering_steps.rb +2 -2
- data/features/step_definitions/point_to_point_steps.rb +19 -9
- data/features/step_definitions/publish_subscribe_steps.rb +22 -8
- data/features/support/env.rb +2 -0
- data/features/support/sample_consumers.rb +6 -6
- data/lib/rosetta_queue.rb +1 -0
- data/lib/rosetta_queue/adapter.rb +6 -6
- data/lib/rosetta_queue/adapters/amqp.rb +6 -3
- data/lib/rosetta_queue/adapters/amqp_evented.rb +22 -22
- data/lib/rosetta_queue/adapters/amqp_synch.rb +42 -36
- data/lib/rosetta_queue/adapters/base.rb +3 -3
- data/lib/rosetta_queue/adapters/beanstalk.rb +5 -5
- data/lib/rosetta_queue/adapters/fake.rb +5 -5
- data/lib/rosetta_queue/adapters/null.rb +9 -9
- data/lib/rosetta_queue/adapters/stomp.rb +25 -12
- data/lib/rosetta_queue/base.rb +2 -2
- data/lib/rosetta_queue/consumer.rb +4 -4
- data/lib/rosetta_queue/consumer_managers/base.rb +8 -6
- data/lib/rosetta_queue/consumer_managers/evented.rb +5 -5
- data/lib/rosetta_queue/consumer_managers/threaded.rb +4 -4
- data/lib/rosetta_queue/core_ext/string.rb +3 -3
- data/lib/rosetta_queue/core_ext/time.rb +20 -0
- data/lib/rosetta_queue/destinations.rb +6 -6
- data/lib/rosetta_queue/filters.rb +8 -8
- data/lib/rosetta_queue/logger.rb +2 -2
- data/lib/rosetta_queue/message_handler.rb +10 -4
- data/lib/rosetta_queue/producer.rb +2 -2
- data/lib/rosetta_queue/spec_helpers/hash.rb +3 -3
- data/lib/rosetta_queue/spec_helpers/helpers.rb +8 -8
- data/lib/rosetta_queue/spec_helpers/publishing_matchers.rb +26 -26
- data/spec/rosetta_queue/adapter_spec.rb +27 -27
- data/spec/rosetta_queue/adapters/amqp_synchronous_spec.rb +21 -1
- data/spec/rosetta_queue/adapters/beanstalk_spec.rb +3 -3
- data/spec/rosetta_queue/adapters/fake_spec.rb +6 -6
- data/spec/rosetta_queue/adapters/null_spec.rb +5 -5
- data/spec/rosetta_queue/adapters/shared_adapter_behavior.rb +4 -4
- data/spec/rosetta_queue/adapters/shared_fanout_behavior.rb +1 -1
- data/spec/rosetta_queue/adapters/stomp_spec.rb +39 -18
- data/spec/rosetta_queue/consumer_managers/evented_spec.rb +6 -6
- data/spec/rosetta_queue/consumer_managers/shared_manager_behavior.rb +3 -3
- data/spec/rosetta_queue/consumer_managers/threaded_spec.rb +5 -5
- data/spec/rosetta_queue/consumer_spec.rb +13 -13
- data/spec/rosetta_queue/core_ext/string_spec.rb +3 -3
- data/spec/rosetta_queue/destinations_spec.rb +8 -8
- data/spec/rosetta_queue/filters_spec.rb +16 -16
- data/spec/rosetta_queue/producer_spec.rb +15 -15
- data/spec/rosetta_queue/shared_messaging_behavior.rb +6 -6
- metadata +3 -2
@@ -7,28 +7,28 @@ module RosettaQueue
|
|
7
7
|
before(:each) do
|
8
8
|
Destinations.clear
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
after(:each) do
|
12
12
|
Destinations.clear
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
it "should map destination to hash" do
|
16
16
|
|
17
|
-
Destinations.define do |queue|
|
17
|
+
Destinations.define do |queue|
|
18
18
|
queue.map :test_queue, "/queue/test_queue"
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
Destinations.lookup(:test_queue).should == "/queue/test_queue"
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
it "#queue_names should return an array of the actuual queue names" do
|
25
|
-
Destinations.define do |queue|
|
25
|
+
Destinations.define do |queue|
|
26
26
|
queue.map :foo, "/queue/foo"
|
27
27
|
queue.map :bar, "/queue/bar"
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
Destinations.queue_names.should include("/queue/foo")
|
31
31
|
Destinations.queue_names.should include("/queue/bar")
|
32
32
|
end
|
33
33
|
end
|
34
|
-
end
|
34
|
+
end
|
@@ -1,44 +1,44 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
2
|
|
3
3
|
module RosettaQueue
|
4
|
-
|
4
|
+
|
5
5
|
describe Filters do
|
6
|
-
|
6
|
+
|
7
7
|
after(:each) do
|
8
8
|
Filters.reset
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
describe "#process_receiving" do
|
12
12
|
it "should process the passed in message with the defined receiving filter" do
|
13
|
-
Filters.define do |f|
|
13
|
+
Filters.define do |f|
|
14
14
|
f.receiving {|message| "Foo #{message}"}
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
Filters.process_receiving("Bar").should == "Foo Bar"
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
it "should return the same message when no filter is defined" do
|
21
21
|
Filters.process_receiving("Bar").should == "Bar"
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
25
|
-
|
24
|
+
|
25
|
+
|
26
26
|
describe "#process_sending" do
|
27
27
|
it "should process the passed in message with the defined sending filter" do
|
28
|
-
Filters.define do |f|
|
28
|
+
Filters.define do |f|
|
29
29
|
f.sending {|message| "Foo #{message}"}
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
Filters.process_sending("Bar").should == "Foo Bar"
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
it "should return the same message when no filter is defined" do
|
36
36
|
Filters.process_sending("Bar").should == "Bar"
|
37
|
-
end
|
37
|
+
end
|
38
38
|
end
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
|
40
|
+
|
41
|
+
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
end
|
@@ -1,42 +1,42 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
2
|
|
3
3
|
module RosettaQueue
|
4
|
-
|
4
|
+
|
5
5
|
class TestProducer < Producer
|
6
6
|
|
7
7
|
publishes_to :test_queue
|
8
8
|
options :persistent => false
|
9
9
|
|
10
10
|
end
|
11
|
-
|
12
|
-
describe Producer do
|
13
|
-
|
11
|
+
|
12
|
+
describe Producer do
|
13
|
+
|
14
14
|
before(:each) do
|
15
15
|
@adapter = mock("adapter", :send_message => nil)
|
16
16
|
RosettaQueue::Adapter.stub!(:instance).and_return(@adapter)
|
17
17
|
@gateway = TestProducer.new
|
18
|
-
|
18
|
+
|
19
19
|
Destinations.stub!(:lookup).and_return("/queue/test_queue")
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
it_should_behave_like "a messaging gateway object"
|
23
23
|
attr_reader :adapter, :gateway
|
24
|
-
|
25
|
-
|
24
|
+
|
25
|
+
|
26
26
|
describe "#publish" do
|
27
|
-
|
27
|
+
|
28
28
|
before(:each) do
|
29
29
|
@adapter = mock("adpater", :send_message => nil)
|
30
30
|
RosettaQueue::Adapter.stub!(:instance).and_return(@adapter)
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
# it "should look up the destination defined on the class" do
|
34
34
|
# Destinations.should_receive(:lookup).with(:test_queue).and_return("/queue/test_queue")
|
35
35
|
# # when
|
36
36
|
# @gateway.publish('some message')
|
37
37
|
# end
|
38
38
|
|
39
|
-
it "should publish messages to queue with the options defined in the class" do
|
39
|
+
it "should publish messages to queue with the options defined in the class" do
|
40
40
|
# TO DO: REFACTOR #publish METHOD SO THAT YOU PASS IN MESSAGE HANDLER AS WITH CONSUMER
|
41
41
|
pending
|
42
42
|
# expect
|
@@ -46,14 +46,14 @@ module RosettaQueue
|
|
46
46
|
end
|
47
47
|
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
describe ".publish" do
|
51
51
|
# it "should look up the destination defined on the class" do
|
52
52
|
# Destinations.should_receive(:lookup).with(:test_queue).and_return("/queue/test_queue")
|
53
53
|
# # when
|
54
54
|
# Producer.publish(:test_queue, "blah")
|
55
55
|
# end
|
56
|
-
|
56
|
+
|
57
57
|
it "should send the message to the adpater along with the options" do
|
58
58
|
# expect
|
59
59
|
@adapter.should_receive(:send_message).with("/queue/test_queue", "Hello World!", {:persistent => true})
|
@@ -61,6 +61,6 @@ module RosettaQueue
|
|
61
61
|
Producer.publish(:test_queue, "Hello World!", {:persistent => true})
|
62
62
|
end
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
end
|
66
|
-
end
|
66
|
+
end
|
@@ -1,21 +1,21 @@
|
|
1
1
|
module RosettaQueue
|
2
2
|
|
3
|
-
describe "a messaging gateway object", :shared => true do
|
4
|
-
|
5
|
-
it "#unsubscribe should be delegated to the adapter" do
|
3
|
+
describe "a messaging gateway object", :shared => true do
|
4
|
+
|
5
|
+
it "#unsubscribe should be delegated to the adapter" do
|
6
6
|
pending
|
7
7
|
# expect
|
8
8
|
adapter.should_receive("unsubscribe")
|
9
9
|
# when
|
10
10
|
gateway.unsubscribe
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
it "#disconnect should be delegated to the adapter" do
|
14
14
|
# expect
|
15
15
|
adapter.should_receive("disconnect")
|
16
16
|
# when
|
17
17
|
gateway.disconnect
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
end
|
21
|
-
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bmabey-rosetta_queue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Mabey
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-08-26 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- lib/rosetta_queue/consumer_managers/evented.rb
|
55
55
|
- lib/rosetta_queue/consumer_managers/threaded.rb
|
56
56
|
- lib/rosetta_queue/core_ext/string.rb
|
57
|
+
- lib/rosetta_queue/core_ext/time.rb
|
57
58
|
- lib/rosetta_queue/destinations.rb
|
58
59
|
- lib/rosetta_queue/exceptions.rb
|
59
60
|
- lib/rosetta_queue/filters.rb
|