action_subscriber 2.5.0.pre-java → 3.0.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/README.md +15 -23
- data/action_subscriber.gemspec +1 -0
- data/lib/action_subscriber.rb +11 -23
- data/lib/action_subscriber/babou.rb +2 -29
- data/lib/action_subscriber/base.rb +0 -4
- data/lib/action_subscriber/bunny/subscriber.rb +18 -4
- data/lib/action_subscriber/configuration.rb +1 -11
- data/lib/action_subscriber/default_routing.rb +6 -4
- data/lib/action_subscriber/march_hare/subscriber.rb +20 -4
- data/lib/action_subscriber/message_retry.rb +1 -1
- data/lib/action_subscriber/middleware/env.rb +3 -1
- data/lib/action_subscriber/middleware/error_handler.rb +20 -4
- data/lib/action_subscriber/rabbit_connection.rb +24 -33
- data/lib/action_subscriber/route.rb +5 -1
- data/lib/action_subscriber/route_set.rb +13 -6
- data/lib/action_subscriber/router.rb +15 -3
- data/lib/action_subscriber/version.rb +1 -1
- data/spec/integration/around_filters_spec.rb +1 -1
- data/spec/integration/at_least_once_spec.rb +1 -1
- data/spec/integration/at_most_once_spec.rb +1 -1
- data/spec/integration/automatic_reconnect_spec.rb +3 -4
- data/spec/integration/basic_subscriber_spec.rb +2 -2
- data/spec/integration/custom_actions_spec.rb +1 -1
- data/spec/integration/custom_headers_spec.rb +2 -2
- data/spec/integration/decoding_payloads_spec.rb +2 -2
- data/spec/integration/manual_acknowledgement_spec.rb +1 -1
- data/spec/integration/multiple_connections_spec.rb +36 -0
- data/spec/integration/multiple_threadpools_spec.rb +3 -3
- data/spec/lib/action_subscriber/configuration_spec.rb +1 -5
- data/spec/lib/action_subscriber/middleware/error_handler_spec.rb +15 -0
- data/spec/spec_helper.rb +8 -4
- metadata +21 -16
- data/lib/action_subscriber/publisher.rb +0 -46
- data/lib/action_subscriber/publisher/async.rb +0 -31
- data/lib/action_subscriber/publisher/async/in_memory_adapter.rb +0 -153
- data/spec/integration/inferred_routes_spec.rb +0 -53
- data/spec/lib/action_subscriber/publisher/async/in_memory_adapter_spec.rb +0 -135
- data/spec/lib/action_subscriber/publisher/async_spec.rb +0 -40
- data/spec/lib/action_subscriber/publisher_spec.rb +0 -35
@@ -1,40 +0,0 @@
|
|
1
|
-
describe ::ActionSubscriber::Publisher::Async do
|
2
|
-
|
3
|
-
before { described_class.instance_variable_set(:@publisher_adapter, nil) }
|
4
|
-
after { ::ActionSubscriber.configuration.async_publisher = "memory" }
|
5
|
-
|
6
|
-
let(:mock_adapter) { double(:publish => nil) }
|
7
|
-
|
8
|
-
describe ".publish_async" do
|
9
|
-
before { allow(described_class).to receive(:publisher_adapter).and_return(mock_adapter) }
|
10
|
-
|
11
|
-
it "calls through the adapter" do
|
12
|
-
expect(mock_adapter).to receive(:publish).with("1", "2", "3", { "four" => "five" })
|
13
|
-
::ActionSubscriber::Publisher.publish_async("1", "2", "3", { "four" => "five" })
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
context "when an in-memory adapter is selected" do
|
18
|
-
before { ::ActionSubscriber.configuration.async_publisher = "memory" }
|
19
|
-
|
20
|
-
it "Creates an in-memory publisher" do
|
21
|
-
expect(described_class.publisher_adapter).to be_an(::ActionSubscriber::Publisher::Async::InMemoryAdapter)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context "when an redis adapter is selected" do
|
26
|
-
before { ::ActionSubscriber.configuration.async_publisher = "redis" }
|
27
|
-
|
28
|
-
it "raises an error" do
|
29
|
-
expect { described_class.publisher_adapter }.to raise_error("Not yet implemented")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context "when some random adapter is selected" do
|
34
|
-
before { ::ActionSubscriber.configuration.async_publisher = "yolo" }
|
35
|
-
|
36
|
-
it "raises an error" do
|
37
|
-
expect { described_class.publisher_adapter }.to raise_error("Unknown adapter 'yolo' provided")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
describe ::ActionSubscriber::Publisher do
|
2
|
-
let(:exchange) { double("Rabbit Exchange") }
|
3
|
-
let(:exchange_name) { "events" }
|
4
|
-
let(:payload) { "Yo Dawg" }
|
5
|
-
let(:route) { "bob.users.created" }
|
6
|
-
|
7
|
-
before { allow(described_class).to receive(:with_exchange).with(exchange_name).and_yield(exchange) }
|
8
|
-
|
9
|
-
describe '.publish' do
|
10
|
-
|
11
|
-
if ::RUBY_PLATFORM == "java"
|
12
|
-
it "publishes to the exchange with default options for march_hare" do
|
13
|
-
expect(exchange).to receive(:publish) do |published_payload, published_options|
|
14
|
-
expect(published_payload).to eq(payload)
|
15
|
-
expect(published_options[:routing_key]).to eq(route)
|
16
|
-
expect(published_options[:mandatory]).to eq(false)
|
17
|
-
expect(published_options[:properties][:persistent]).to eq(false)
|
18
|
-
end
|
19
|
-
|
20
|
-
described_class.publish(route, payload, exchange_name)
|
21
|
-
end
|
22
|
-
else
|
23
|
-
it "publishes to the exchange with default options for bunny" do
|
24
|
-
expect(exchange).to receive(:publish) do |published_payload, published_options|
|
25
|
-
expect(published_payload).to eq(payload)
|
26
|
-
expect(published_options[:routing_key]).to eq(route)
|
27
|
-
expect(published_options[:persistent]).to eq(false)
|
28
|
-
expect(published_options[:mandatory]).to eq(false)
|
29
|
-
end
|
30
|
-
|
31
|
-
described_class.publish(route, payload, exchange_name)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|