pwwka 0.13.0.RC1 → 0.13.0.RC2
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/pwwka/configuration.rb +23 -9
- data/lib/pwwka/version.rb +1 -1
- data/spec/integration/unhandled_errors_in_receivers_spec.rb +1 -0
- data/spec/unit/configuration_spec.rb +40 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd8463f1ae68bd33512f90d6dc9925bd78475d4c
|
4
|
+
data.tar.gz: f1b8197403748e2c5e56fcc206246508d03b5ab4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a65a393afb21da57d4e7039a383cae9db6631d1e06eca582d522b854b18a689fc2a605bd9b444331619c05d9b6a05653e36fe3bbb71a406b6b9f210b34e165c
|
7
|
+
data.tar.gz: e1bc690879b66874219c42a98129588d33ab6f8cb1df4e30bc6a04b23238df8f493c4fb796baf03d718617141233692034de6cd5563986073400ab53cf3dd77b
|
data/Gemfile.lock
CHANGED
data/lib/pwwka/configuration.rb
CHANGED
@@ -15,15 +15,6 @@ module Pwwka
|
|
15
15
|
attr_writer :app_id
|
16
16
|
attr_writer :error_handling_chain
|
17
17
|
|
18
|
-
def keep_alive_on_handler_klass_exceptions=(val)
|
19
|
-
@keep_alive_on_handler_klass_exceptions = val
|
20
|
-
@error_handling_chain = nil
|
21
|
-
end
|
22
|
-
def requeue_on_error=(val)
|
23
|
-
@requeue_on_error = val
|
24
|
-
@error_handling_chain = nil
|
25
|
-
end
|
26
|
-
|
27
18
|
def initialize
|
28
19
|
@rabbit_mq_host = nil
|
29
20
|
@topic_exchange_name = "pwwka.topics.#{Pwwka.environment}"
|
@@ -85,5 +76,28 @@ module Pwwka
|
|
85
76
|
end
|
86
77
|
end
|
87
78
|
|
79
|
+
def keep_alive_on_handler_klass_exceptions=(val)
|
80
|
+
@keep_alive_on_handler_klass_exceptions = val
|
81
|
+
if @keep_alive_on_handler_klass_exceptions
|
82
|
+
@error_handling_chain.delete(Pwwka::ErrorHandlers::Crash)
|
83
|
+
elsif !@error_handling_chain.include?(Pwwka::ErrorHandlers::Crash)
|
84
|
+
@error_handling_chain << Pwwka::ErrorHandlers::Crash
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def requeue_on_error=(val)
|
89
|
+
@requeue_on_error = val
|
90
|
+
if @requeue_on_error
|
91
|
+
index = error_handling_chain.index(Pwwka::ErrorHandlers::NackAndIgnore)
|
92
|
+
if index
|
93
|
+
@error_handling_chain[index] = Pwwka::ErrorHandlers::NackAndRequeueOnce
|
94
|
+
end
|
95
|
+
else
|
96
|
+
index = error_handling_chain.index(Pwwka::ErrorHandlers::NackAndRequeueOnce)
|
97
|
+
if index
|
98
|
+
@error_handling_chain[index] = Pwwka::ErrorHandlers::NackAndIgnore
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
88
102
|
end
|
89
103
|
end
|
data/lib/pwwka/version.rb
CHANGED
@@ -8,6 +8,7 @@ describe "receivers with unhandled errors", :integration do
|
|
8
8
|
|
9
9
|
before do
|
10
10
|
@testing_setup = IntegrationTestSetup.new
|
11
|
+
Pwwka.configuration.instance_variable_set("@error_handling_chain",nil)
|
11
12
|
Pwwka.configure do |c|
|
12
13
|
c.requeue_on_error = false
|
13
14
|
c.keep_alive_on_handler_klass_exceptions = false
|
@@ -79,4 +79,44 @@ describe Pwwka::Configuration do
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
82
|
+
|
83
|
+
describe "#error_handling_chain" do
|
84
|
+
before do
|
85
|
+
configuration.instance_variable_set("@error_handling_chain",nil)
|
86
|
+
end
|
87
|
+
context "implicit configuration" do
|
88
|
+
context "when requeue_on_error" do
|
89
|
+
context "when keep_alive_on_handler_klass_exceptions" do
|
90
|
+
it "is NackAndRequeueOnce" do
|
91
|
+
configuration.requeue_on_error = true
|
92
|
+
configuration.keep_alive_on_handler_klass_exceptions = true
|
93
|
+
expect(configuration.error_handling_chain).to eq([Pwwka::ErrorHandlers::NackAndRequeueOnce])
|
94
|
+
end
|
95
|
+
end
|
96
|
+
context "when not keep_alive_on_handler_klass_exceptions" do
|
97
|
+
it "is NackAndRequeueOnce,Crash" do
|
98
|
+
configuration.requeue_on_error = true
|
99
|
+
configuration.keep_alive_on_handler_klass_exceptions = false
|
100
|
+
expect(configuration.error_handling_chain).to eq([Pwwka::ErrorHandlers::NackAndRequeueOnce,Pwwka::ErrorHandlers::Crash])
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
context "when not requeue_on_error" do
|
105
|
+
context "when keep_alive_on_handler_klass_exceptions" do
|
106
|
+
it "is NackAndIgnore" do
|
107
|
+
configuration.requeue_on_error = false
|
108
|
+
configuration.keep_alive_on_handler_klass_exceptions = true
|
109
|
+
expect(configuration.error_handling_chain).to eq([Pwwka::ErrorHandlers::NackAndIgnore])
|
110
|
+
end
|
111
|
+
end
|
112
|
+
context "when not keep_alive_on_handler_klass_exceptions" do
|
113
|
+
it "is NackAndIgnore,Crash" do
|
114
|
+
configuration.requeue_on_error = false
|
115
|
+
configuration.keep_alive_on_handler_klass_exceptions = false
|
116
|
+
expect(configuration.error_handling_chain).to eq([Pwwka::ErrorHandlers::NackAndIgnore,Pwwka::ErrorHandlers::Crash])
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
82
122
|
end
|