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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -2
  3. data/README.md +15 -23
  4. data/action_subscriber.gemspec +1 -0
  5. data/lib/action_subscriber.rb +11 -23
  6. data/lib/action_subscriber/babou.rb +2 -29
  7. data/lib/action_subscriber/base.rb +0 -4
  8. data/lib/action_subscriber/bunny/subscriber.rb +18 -4
  9. data/lib/action_subscriber/configuration.rb +1 -11
  10. data/lib/action_subscriber/default_routing.rb +6 -4
  11. data/lib/action_subscriber/march_hare/subscriber.rb +20 -4
  12. data/lib/action_subscriber/message_retry.rb +1 -1
  13. data/lib/action_subscriber/middleware/env.rb +3 -1
  14. data/lib/action_subscriber/middleware/error_handler.rb +20 -4
  15. data/lib/action_subscriber/rabbit_connection.rb +24 -33
  16. data/lib/action_subscriber/route.rb +5 -1
  17. data/lib/action_subscriber/route_set.rb +13 -6
  18. data/lib/action_subscriber/router.rb +15 -3
  19. data/lib/action_subscriber/version.rb +1 -1
  20. data/spec/integration/around_filters_spec.rb +1 -1
  21. data/spec/integration/at_least_once_spec.rb +1 -1
  22. data/spec/integration/at_most_once_spec.rb +1 -1
  23. data/spec/integration/automatic_reconnect_spec.rb +3 -4
  24. data/spec/integration/basic_subscriber_spec.rb +2 -2
  25. data/spec/integration/custom_actions_spec.rb +1 -1
  26. data/spec/integration/custom_headers_spec.rb +2 -2
  27. data/spec/integration/decoding_payloads_spec.rb +2 -2
  28. data/spec/integration/manual_acknowledgement_spec.rb +1 -1
  29. data/spec/integration/multiple_connections_spec.rb +36 -0
  30. data/spec/integration/multiple_threadpools_spec.rb +3 -3
  31. data/spec/lib/action_subscriber/configuration_spec.rb +1 -5
  32. data/spec/lib/action_subscriber/middleware/error_handler_spec.rb +15 -0
  33. data/spec/spec_helper.rb +8 -4
  34. metadata +21 -16
  35. data/lib/action_subscriber/publisher.rb +0 -46
  36. data/lib/action_subscriber/publisher/async.rb +0 -31
  37. data/lib/action_subscriber/publisher/async/in_memory_adapter.rb +0 -153
  38. data/spec/integration/inferred_routes_spec.rb +0 -53
  39. data/spec/lib/action_subscriber/publisher/async/in_memory_adapter_spec.rb +0 -135
  40. data/spec/lib/action_subscriber/publisher/async_spec.rb +0 -40
  41. 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