emque-consuming 1.1.2 → 1.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +1 -0
- data/lib/emque/consuming/application.rb +8 -2
- data/lib/emque/consuming/cli.rb +12 -0
- data/lib/emque/consuming/configuration.rb +6 -4
- data/lib/emque/consuming/version.rb +1 -1
- data/spec/application_spec.rb +16 -0
- data/spec/configuration_spec.rb +3 -3
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12f58267d541cb53c2dcd731663e1c19da52c801
|
4
|
+
data.tar.gz: c9555bff3fc2315e542cd637d4d2a4f387895169
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fce1adb82ccb832409b252e1ed3d2741fc80ae8e4706cac533bd594141915b10d98a3aacef168fc145e3f95170c3e9ef5675d402bad1a46b4651e069b4012fc
|
7
|
+
data.tar.gz: d0d287ed1519c23dcccc52bf9cc1dd3641af322d0ba1f47382a4fcc529321eb1251c714394bf3a5cf575d545bfc45d78dfad59b309683ae87dc907eb2f22c661
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
|
1
|
+
# Emque Consuming CHANGELOG
|
2
|
+
|
3
|
+
- [Add in a configuration option to disable auto shutdown on reaching the error limit](https://github.com/emque/emque-consuming/pull/58) 1.1.3
|
4
|
+
|
5
|
+
## 1.0.0.beta4
|
2
6
|
|
3
7
|
### BREAKING CHANGE - New Queue Names
|
4
8
|
Applications updating to this version will have new queue names in RabbitMQ.
|
data/README.md
CHANGED
@@ -157,6 +157,7 @@ emque <options> (start|stop|new|console|help) <name (new only)>
|
|
157
157
|
-x, --error-expiration SECONDS Expire errors after SECONDS
|
158
158
|
--app-name NAME Run the application as NAME
|
159
159
|
--env (ex. production) Set the application environment, overrides EMQUE_ENV
|
160
|
+
--auto-shutdown (false|true) Enable or disable auto shutdown on reaching the error limit
|
160
161
|
```
|
161
162
|
|
162
163
|
and a series of rake commands:
|
@@ -62,13 +62,19 @@ module Emque
|
|
62
62
|
|
63
63
|
def verify_error_status
|
64
64
|
if error_tracker.limit_reached?
|
65
|
-
|
66
|
-
|
65
|
+
if auto_shutdown_enabled
|
66
|
+
handle_shutdown
|
67
|
+
runner.stop
|
68
|
+
end
|
67
69
|
end
|
68
70
|
end
|
69
71
|
|
70
72
|
# private
|
71
73
|
|
74
|
+
def auto_shutdown_enabled
|
75
|
+
config.auto_shutdown
|
76
|
+
end
|
77
|
+
|
72
78
|
def ensure_adapter_is_configured!
|
73
79
|
if config.adapter.nil?
|
74
80
|
raise AdapterConfigurationError,
|
data/lib/emque/consuming/cli.rb
CHANGED
@@ -132,6 +132,18 @@ module Emque
|
|
132
132
|
options[:env] = arg
|
133
133
|
end
|
134
134
|
|
135
|
+
o.on(
|
136
|
+
"--auto-shutdown (false|true)",
|
137
|
+
"Enable or disable auto shutdown on reaching the error limit"
|
138
|
+
) do |arg|
|
139
|
+
exp = arg.to_s
|
140
|
+
if exp == "true"
|
141
|
+
options[:auto_shutdown] = true
|
142
|
+
else
|
143
|
+
options[:auto_shutdown] = false
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
135
147
|
o.banner = "emque <options> (start|stop|new|console|help) <name (new only)>"
|
136
148
|
}
|
137
149
|
end
|
@@ -3,13 +3,14 @@ require "logger"
|
|
3
3
|
module Emque
|
4
4
|
module Consuming
|
5
5
|
class Configuration
|
6
|
-
attr_accessor :app_name, :
|
7
|
-
:error_expiration, :status, :status_port, :status_host,
|
8
|
-
:shutdown_handlers
|
6
|
+
attr_accessor :app_name, :auto_shutdown, :adapter, :error_handlers,
|
7
|
+
:error_limit, :error_expiration, :status, :status_port, :status_host,
|
8
|
+
:socket_path, :shutdown_handlers
|
9
9
|
attr_writer :env, :log_level
|
10
10
|
|
11
11
|
def initialize
|
12
|
-
@app_name
|
12
|
+
@app_name = ""
|
13
|
+
@auto_shutdown = false
|
13
14
|
@error_handlers = []
|
14
15
|
@error_limit = 5
|
15
16
|
@error_expiration = 3600 # 60 minutes
|
@@ -41,6 +42,7 @@ module Emque
|
|
41
42
|
{}.tap { |config|
|
42
43
|
[
|
43
44
|
:app_name,
|
45
|
+
:auto_shutdown,
|
44
46
|
:adapter,
|
45
47
|
:env,
|
46
48
|
:error_handlers,
|
data/spec/application_spec.rb
CHANGED
@@ -14,6 +14,7 @@ describe Emque::Consuming::Application do
|
|
14
14
|
|
15
15
|
it "triggers a shutdown one the error_limit is reached" do
|
16
16
|
Dummy::Application.config.error_limit = 2
|
17
|
+
Dummy::Application.config.auto_shutdown = true
|
17
18
|
app = Dummy::Application.new
|
18
19
|
Emque::Consuming::Runner.instance =
|
19
20
|
double(:runner, :status => double(:status, :to_h => {}))
|
@@ -24,5 +25,20 @@ describe Emque::Consuming::Application do
|
|
24
25
|
app.notice_error({ :test => "failure" })
|
25
26
|
app.notice_error({ :test => "another failure" })
|
26
27
|
end
|
28
|
+
|
29
|
+
it "doesn't shutdown if the error_limit is disabled" do
|
30
|
+
Dummy::Application.config.error_limit = 2
|
31
|
+
Dummy::Application.config.auto_shutdown = false
|
32
|
+
app = Dummy::Application.new
|
33
|
+
Emque::Consuming::Runner.instance =
|
34
|
+
double(:runner, :status => double(:status, :to_h => {}))
|
35
|
+
|
36
|
+
expect(Emque::Consuming::Runner.instance)
|
37
|
+
.to receive(:stop).exactly(0).times
|
38
|
+
|
39
|
+
app.notice_error({ :test => "failure" })
|
40
|
+
app.notice_error({ :test => "another failure" })
|
41
|
+
|
42
|
+
end
|
27
43
|
end
|
28
44
|
end
|
data/spec/configuration_spec.rb
CHANGED
@@ -22,9 +22,9 @@ describe Emque::Consuming::Configuration do
|
|
22
22
|
|
23
23
|
it "returns the value of all the accessors" do
|
24
24
|
accessors = [
|
25
|
-
:app_name, :adapter, :env, :error_handlers,
|
26
|
-
:error_expiration, :log_level, :status_port, :status_host,
|
27
|
-
:socket_path, :shutdown_handlers
|
25
|
+
:app_name, :auto_shutdown, :adapter, :env, :error_handlers,
|
26
|
+
:error_limit, :error_expiration, :log_level, :status_port, :status_host,
|
27
|
+
:status, :socket_path, :shutdown_handlers
|
28
28
|
]
|
29
29
|
config = Emque::Consuming::Configuration.new
|
30
30
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emque-consuming
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Williams
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-05-
|
12
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: celluloid
|
@@ -287,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
287
287
|
version: '0'
|
288
288
|
requirements: []
|
289
289
|
rubyforge_project:
|
290
|
-
rubygems_version: 2.
|
290
|
+
rubygems_version: 2.2.2
|
291
291
|
signing_key:
|
292
292
|
specification_version: 4
|
293
293
|
summary: Microservices framework for Ruby
|
@@ -307,4 +307,3 @@ test_files:
|
|
307
307
|
- spec/router_spec.rb
|
308
308
|
- spec/runner_spec.rb
|
309
309
|
- spec/spec_helper.rb
|
310
|
-
has_rdoc:
|