eventboss 1.7.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/bundler_audit.yml +24 -0
- data/.github/workflows/rspec.yml +28 -0
- data/Gemfile.lock +32 -30
- data/README.md +2 -2
- data/docker-compose.test.yml +27 -0
- data/eventboss.gemspec +2 -1
- data/lib/eventboss/development_mode.rb +3 -0
- data/lib/eventboss/error_handlers/rollbar.rb +7 -1
- data/lib/eventboss/error_handlers/sentry.rb +17 -0
- data/lib/eventboss/extensions.rb +1 -0
- data/lib/eventboss/long_poller.rb +1 -1
- data/lib/eventboss/version.rb +1 -1
- data/lib/tasks/eventboss.rake +21 -6
- metadata +25 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4628ccf4b64bbc755253aedf850c096998ed965231ac1464de4384872d2d1f1
|
4
|
+
data.tar.gz: cc0661659e16a84c8e5073fba547ca934038c8e769bdd5a06ad4c126511a4f4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4e2ea1c6484a55a08b6a4067e94cd3171c4bc165930ec5475077263ccc7a898a96d5cef6917daf680483f61841d597b7c77019d783fcf11bf5a39b020dd5d29
|
7
|
+
data.tar.gz: 2198208804156ab4a6a99e2624a970c9d494c325e4648b3c53eec207f8ecbf2b0ce5cc5e5d932ca0531bb58410d2d595fa1b7250a39b48749085e8bdfcbf610b
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: Run Bundler Audit
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
run-bundler_audit:
|
8
|
+
name: Run bundler audit
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
ruby-version: ["3.0"]
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- name: Set up Ruby
|
16
|
+
uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby-version }}
|
19
|
+
- name: Install bundle audit
|
20
|
+
run: gem install bundle-audit
|
21
|
+
- name: Update Ruby Advisory Database
|
22
|
+
run: bundle-audit update
|
23
|
+
- name: Run audit
|
24
|
+
run: bundle audit
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: Run RSpec tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_call:
|
5
|
+
workflow_dispatch:
|
6
|
+
pull_request:
|
7
|
+
|
8
|
+
env:
|
9
|
+
APPLICATION_NAME: eventboss
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
run-tests:
|
13
|
+
name: Run RSpec
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
strategy:
|
16
|
+
matrix:
|
17
|
+
ruby-version: ["3.0"]
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v2
|
20
|
+
- name: Set up Ruby
|
21
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby
|
22
|
+
uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: ${{ matrix.ruby-version }}
|
25
|
+
# runs 'bundle install' and caches installed gems automatically
|
26
|
+
bundler-cache: true
|
27
|
+
- name: Run tests
|
28
|
+
run: bundle exec rspec
|
data/Gemfile.lock
CHANGED
@@ -1,55 +1,57 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
eventboss (1.
|
4
|
+
eventboss (1.8.1)
|
5
5
|
aws-sdk-sns (>= 1.1.0)
|
6
6
|
aws-sdk-sqs (>= 1.3.0)
|
7
7
|
dotenv (~> 2.1, >= 2.1.1)
|
8
|
+
rexml (~> 3.0)
|
8
9
|
|
9
10
|
GEM
|
10
11
|
remote: https://rubygems.org/
|
11
12
|
specs:
|
12
|
-
aws-eventstream (1.
|
13
|
-
aws-partitions (1.
|
14
|
-
aws-sdk-core (3.
|
15
|
-
aws-eventstream (~> 1, >= 1.0
|
16
|
-
aws-partitions (~> 1, >= 1.
|
17
|
-
aws-sigv4 (~> 1.
|
18
|
-
jmespath (~> 1.
|
19
|
-
aws-sdk-sns (1.
|
20
|
-
aws-sdk-core (~> 3, >= 3.
|
13
|
+
aws-eventstream (1.3.0)
|
14
|
+
aws-partitions (1.894.0)
|
15
|
+
aws-sdk-core (3.191.3)
|
16
|
+
aws-eventstream (~> 1, >= 1.3.0)
|
17
|
+
aws-partitions (~> 1, >= 1.651.0)
|
18
|
+
aws-sigv4 (~> 1.8)
|
19
|
+
jmespath (~> 1, >= 1.6.1)
|
20
|
+
aws-sdk-sns (1.72.0)
|
21
|
+
aws-sdk-core (~> 3, >= 3.191.0)
|
21
22
|
aws-sigv4 (~> 1.1)
|
22
|
-
aws-sdk-sqs (1.
|
23
|
-
aws-sdk-core (~> 3, >= 3.
|
23
|
+
aws-sdk-sqs (1.70.0)
|
24
|
+
aws-sdk-core (~> 3, >= 3.191.0)
|
24
25
|
aws-sigv4 (~> 1.1)
|
25
|
-
aws-sigv4 (1.
|
26
|
+
aws-sigv4 (1.8.0)
|
26
27
|
aws-eventstream (~> 1, >= 1.0.2)
|
27
|
-
diff-lcs (1.
|
28
|
-
dotenv (2.
|
29
|
-
jmespath (1.
|
30
|
-
rake (13.0.
|
31
|
-
|
32
|
-
|
33
|
-
rspec-
|
34
|
-
rspec-
|
35
|
-
|
36
|
-
|
37
|
-
|
28
|
+
diff-lcs (1.5.0)
|
29
|
+
dotenv (2.8.1)
|
30
|
+
jmespath (1.6.2)
|
31
|
+
rake (13.0.6)
|
32
|
+
rexml (3.2.6)
|
33
|
+
rspec (3.11.0)
|
34
|
+
rspec-core (~> 3.11.0)
|
35
|
+
rspec-expectations (~> 3.11.0)
|
36
|
+
rspec-mocks (~> 3.11.0)
|
37
|
+
rspec-core (3.11.0)
|
38
|
+
rspec-support (~> 3.11.0)
|
39
|
+
rspec-expectations (3.11.0)
|
38
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
-
rspec-support (~> 3.
|
40
|
-
rspec-mocks (3.
|
41
|
+
rspec-support (~> 3.11.0)
|
42
|
+
rspec-mocks (3.11.0)
|
41
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
-
rspec-support (~> 3.
|
43
|
-
rspec-support (3.
|
44
|
+
rspec-support (~> 3.11.0)
|
45
|
+
rspec-support (3.11.0)
|
44
46
|
|
45
47
|
PLATFORMS
|
46
48
|
ruby
|
47
49
|
|
48
50
|
DEPENDENCIES
|
49
|
-
bundler (
|
51
|
+
bundler (>= 1)
|
50
52
|
eventboss!
|
51
53
|
rake (>= 10.0)
|
52
54
|
rspec (~> 3.0)
|
53
55
|
|
54
56
|
BUNDLED WITH
|
55
|
-
2.
|
57
|
+
2.3.7
|
data/README.md
CHANGED
@@ -100,8 +100,8 @@ EVENTBOSS_ENV=env_name # production/staging/test
|
|
100
100
|
EVENTBOSS_REGION=aws_region # i.e. eu-west-1
|
101
101
|
EVENTBOSS_CONCURRENCY=10 # default is 25
|
102
102
|
|
103
|
-
AWS_SNS_ENDPOINT=http://localhost:
|
104
|
-
AWS_SQS_ENDPOINT=http://localhost:
|
103
|
+
AWS_SNS_ENDPOINT=http://localhost:4566 # when using with localstack
|
104
|
+
AWS_SQS_ENDPOINT=http://localhost:4566 # when using with localstack
|
105
105
|
```
|
106
106
|
Use fixed account ID for localstack setup:
|
107
107
|
```
|
@@ -0,0 +1,27 @@
|
|
1
|
+
version: '2'
|
2
|
+
services:
|
3
|
+
web:
|
4
|
+
build:
|
5
|
+
context: .
|
6
|
+
dockerfile: Dockerfile-test
|
7
|
+
env_file:
|
8
|
+
- .env.example
|
9
|
+
volumes:
|
10
|
+
- tmp:/usr/src/app/tmp
|
11
|
+
- log:/usr/src/app/log
|
12
|
+
pronto:
|
13
|
+
build:
|
14
|
+
context: .
|
15
|
+
dockerfile: Dockerfile-test
|
16
|
+
volumes:
|
17
|
+
- .:/usr/src/app
|
18
|
+
entrypoint: ""
|
19
|
+
command: bash -c "bundle exec pronto run -f github_status text -c origin/master"
|
20
|
+
environment:
|
21
|
+
GITHUB_ACCESS_TOKEN: ${GITHUB_ACCESS_TOKEN}
|
22
|
+
RACK_ENV: test
|
23
|
+
RAILS_ENV: test
|
24
|
+
|
25
|
+
volumes:
|
26
|
+
log:
|
27
|
+
tmp:
|
data/eventboss.gemspec
CHANGED
@@ -23,8 +23,9 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_dependency "aws-sdk-sqs", ">= 1.3.0"
|
24
24
|
spec.add_dependency "aws-sdk-sns", ">= 1.1.0"
|
25
25
|
spec.add_dependency "dotenv", "~> 2.1", ">= 2.1.1"
|
26
|
+
spec.add_dependency "rexml", "~> 3.0"
|
26
27
|
|
27
|
-
spec.add_development_dependency "bundler", "
|
28
|
+
spec.add_development_dependency "bundler", ">= 1"
|
28
29
|
spec.add_development_dependency 'rake', '>= 10.0'
|
29
30
|
spec.add_development_dependency "rspec", "~> 3.0"
|
30
31
|
end
|
@@ -17,6 +17,9 @@ module Eventboss
|
|
17
17
|
logger.info('development-mode') { "Creating queue #{queue.name}..." }
|
18
18
|
sqs_client.create_queue(queue_name: queue.name)
|
19
19
|
|
20
|
+
logger.info('development-mode') { "Creating deadletter queue #{queue.name}-deadletter..." }
|
21
|
+
sqs_client.create_queue(queue_name: "#{queue.name}-deadletter")
|
22
|
+
|
20
23
|
logger.info('development-mode') { "Setting up queue #{queue.name} policy..." }
|
21
24
|
policy = queue_policy(queue.arn, topic.topic_arn)
|
22
25
|
sqs_client.set_queue_attributes(queue_url: queue.url, attributes: { Policy: policy.to_json })
|
@@ -4,7 +4,13 @@ module Eventboss
|
|
4
4
|
def call(exception, context = {})
|
5
5
|
eventboss_context = { component: 'eventboss' }
|
6
6
|
eventboss_context[:action] = context[:processor].class.to_s if context[:processor]
|
7
|
-
|
7
|
+
|
8
|
+
default_options = { use_exception_level_filters: true }
|
9
|
+
|
10
|
+
::Rollbar.error(
|
11
|
+
exception,
|
12
|
+
context.merge(eventboss_context, default_options)
|
13
|
+
)
|
8
14
|
end
|
9
15
|
end
|
10
16
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Eventboss
|
2
|
+
module ErrorHandlers
|
3
|
+
class Sentry
|
4
|
+
def call(exception, context = {})
|
5
|
+
eventboss_context = { component: 'eventboss' }
|
6
|
+
eventboss_context[:action] = context[:processor].class.to_s if context[:processor]
|
7
|
+
|
8
|
+
::Sentry.with_scope do |scope|
|
9
|
+
scope.set_tags(
|
10
|
+
context.merge(eventboss_context)
|
11
|
+
)
|
12
|
+
::Sentry.capture_exception(exception)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/eventboss/extensions.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'eventboss/error_handlers/logger'
|
2
2
|
require 'eventboss/error_handlers/airbrake'
|
3
3
|
require 'eventboss/error_handlers/rollbar'
|
4
|
+
require 'eventboss/error_handlers/sentry'
|
4
5
|
require 'eventboss/error_handlers/db_connection_drop_handler'
|
5
6
|
require 'eventboss/error_handlers/db_connection_not_established_handler'
|
6
7
|
require 'eventboss/error_handlers/non_existent_queue_handler'
|
@@ -55,7 +55,7 @@ module Eventboss
|
|
55
55
|
@launcher.poller_stopped(self)
|
56
56
|
rescue Eventboss::Shutdown
|
57
57
|
@launcher.poller_stopped(self)
|
58
|
-
rescue Aws::SQS::Errors::NonExistentQueue
|
58
|
+
rescue Aws::SQS::Errors::NonExistentQueue => exception
|
59
59
|
handle_exception(exception, poller_id: id)
|
60
60
|
@launcher.poller_stopped(self)
|
61
61
|
rescue StandardError => exception
|
data/lib/eventboss/version.rb
CHANGED
data/lib/tasks/eventboss.rake
CHANGED
@@ -6,6 +6,9 @@ namespace :eventboss do
|
|
6
6
|
task :reload, [:event_name, :source_app, :max_messages] do |task, args|
|
7
7
|
source_app = args[:source_app]
|
8
8
|
event_name = args[:event_name]
|
9
|
+
start_time = Time.now
|
10
|
+
|
11
|
+
Eventboss.logger.info "[#{task.name}] Start task"
|
9
12
|
|
10
13
|
# Zero means: fetch all messages
|
11
14
|
max_messages = args[:max_messages].to_i
|
@@ -17,13 +20,11 @@ namespace :eventboss do
|
|
17
20
|
|
18
21
|
queue_name = compose_queue_name(source_app, event_name)
|
19
22
|
|
20
|
-
|
23
|
+
Eventboss.logger.info "[#{task.name}] Reloading #{queue_name}-deadletter (max: #{ max_messages }, batch: #{ batch_size })"
|
21
24
|
queue = Eventboss::Queue.new("#{queue_name}-deadletter")
|
22
25
|
send_queue = Eventboss::Queue.new(queue_name)
|
23
26
|
|
24
|
-
|
25
|
-
puts "[#{task.name}] to"
|
26
|
-
puts "[#{task.name}] #{send_queue.url}"
|
27
|
+
Eventboss.logger.info "[#{task.name}] #{queue.url} to #{send_queue.url}"
|
27
28
|
|
28
29
|
fetcher = Eventboss::Fetcher.new(Eventboss.configuration)
|
29
30
|
client = fetcher.client
|
@@ -42,16 +43,24 @@ namespace :eventboss do
|
|
42
43
|
|
43
44
|
break if max_messages > 0 && total >= max_messages
|
44
45
|
end
|
46
|
+
Eventboss.logger.info <<~HEREDOC
|
47
|
+
[#{task.name}] Task done
|
48
|
+
total messages: #{total}
|
49
|
+
total time: #{Time.now - start_time}s
|
50
|
+
HEREDOC
|
45
51
|
end
|
46
52
|
|
47
53
|
desc 'Purge deadletter queue'
|
48
54
|
task :purge, [:event_name, :source_app, :max_messages] do |task, args|
|
49
55
|
source_app = args[:source_app]
|
50
56
|
event_name = args[:event_name]
|
57
|
+
start_time = Time.now
|
51
58
|
|
52
59
|
# Zero means: fetch all messages
|
53
60
|
max_messages = args[:max_messages].to_i
|
54
61
|
|
62
|
+
Eventboss.logger.info "[#{task.name}] Start task"
|
63
|
+
|
55
64
|
# Ensure we don't fetch more than 10 messages from SQS
|
56
65
|
batch_size = max_messages == 0 ? 10 : [10, max_messages].min
|
57
66
|
|
@@ -59,9 +68,9 @@ namespace :eventboss do
|
|
59
68
|
|
60
69
|
queue_name = compose_queue_name(source_app, event_name)
|
61
70
|
|
62
|
-
|
71
|
+
Eventboss.logger.info "[#{task.name}] Purging #{queue_name}-deadletter (max: #{ max_messages }, batch: #{ batch_size })"
|
63
72
|
queue = Eventboss::Queue.new("#{queue_name}-deadletter")
|
64
|
-
|
73
|
+
Eventboss.logger.info "[#{task.name}] #{queue.url}"
|
65
74
|
|
66
75
|
fetcher = Eventboss::Fetcher.new(Eventboss.configuration)
|
67
76
|
total = 0
|
@@ -78,6 +87,12 @@ namespace :eventboss do
|
|
78
87
|
|
79
88
|
break if max_messages > 0 && total >= max_messages
|
80
89
|
end
|
90
|
+
|
91
|
+
Eventboss.logger.info <<~HEREDOC
|
92
|
+
[#{task.name}] Task done
|
93
|
+
total messages: #{total}
|
94
|
+
total time: #{Time.now - start_time}s
|
95
|
+
HEREDOC
|
81
96
|
end
|
82
97
|
|
83
98
|
def compose_queue_name(source_app, event_name)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventboss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AirHelp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-sqs
|
@@ -59,19 +59,33 @@ dependencies:
|
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: 2.1.1
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: rexml
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
68
|
-
type: :
|
67
|
+
version: '3.0'
|
68
|
+
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '3.0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: bundler
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '1'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1'
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: rake
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +122,8 @@ executables:
|
|
108
122
|
extensions: []
|
109
123
|
extra_rdoc_files: []
|
110
124
|
files:
|
125
|
+
- ".github/workflows/bundler_audit.yml"
|
126
|
+
- ".github/workflows/rspec.yml"
|
111
127
|
- ".gitignore"
|
112
128
|
- ".rspec"
|
113
129
|
- ".travis.yml"
|
@@ -119,6 +135,7 @@ files:
|
|
119
135
|
- README.md
|
120
136
|
- Rakefile
|
121
137
|
- bin/eventboss
|
138
|
+
- docker-compose.test.yml
|
122
139
|
- eventboss.gemspec
|
123
140
|
- lib/eventboss.rb
|
124
141
|
- lib/eventboss/cli.rb
|
@@ -130,6 +147,7 @@ files:
|
|
130
147
|
- lib/eventboss/error_handlers/logger.rb
|
131
148
|
- lib/eventboss/error_handlers/non_existent_queue_handler.rb
|
132
149
|
- lib/eventboss/error_handlers/rollbar.rb
|
150
|
+
- lib/eventboss/error_handlers/sentry.rb
|
133
151
|
- lib/eventboss/extensions.rb
|
134
152
|
- lib/eventboss/fetcher.rb
|
135
153
|
- lib/eventboss/instrumentation.rb
|
@@ -173,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
191
|
- !ruby/object:Gem::Version
|
174
192
|
version: '0'
|
175
193
|
requirements: []
|
176
|
-
rubygems_version: 3.
|
194
|
+
rubygems_version: 3.5.5
|
177
195
|
signing_key:
|
178
196
|
specification_version: 4
|
179
197
|
summary: Eventboss Ruby Client.
|