eventboss 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b837d9db4a587bec35fc7d31765551263011c2bd33559944c7de34ffa885c3b
4
- data.tar.gz: 3b0f1808873bf4a8d2b5407b82de0ced2f86a2bd5f67775f4f3c73493dfe1bd7
3
+ metadata.gz: 96d1bb368bb5d3178aba2cf5a00bec49444f24e3a0b768d3128651d14947248e
4
+ data.tar.gz: 98c2d5c2e7c64a629ef7ceedb31bfb74798c6a61d781fea22c52e36f132fd2b4
5
5
  SHA512:
6
- metadata.gz: d7c7a8696654ccefd5d25596a9f439c8fbbd8ca41a71525f195010fbb0f469db5f6937632e0b6c46a67cb774b67fc3aeec174e507e649f46c2ab76e55ea56dee
7
- data.tar.gz: 4d7c2b81fc401f5d7890ad1144ee87cd933a34470110a50b7d94e6d88fbcf5792f938777f7b93b3ec37280dc09d5b7c17f2e2b9ac9dc34f50f0c8ed4075af8ed
6
+ metadata.gz: c54b9a6375dc06ce7dd516513b5e09c0f8eda8c79e796694cb9fbceaa348bff1bc196e83d400f2355b323b85b344018b13c8194505c37773b04c7196d6d6c012
7
+ data.tar.gz: a64d2636b7d9a8dbb910d85f36eedd873abdeb7b7b7aa078c19fcb67772d6de7f6dfc353117cf1b0ea84505c3f5aa5f87d48a4deb2c68beb504b4a6cfe24333c
@@ -0,0 +1,40 @@
1
+ name: Verify
2
+ # Source: https://github.com/actions/setup-ruby
3
+
4
+ on:
5
+ push:
6
+ branches: [master]
7
+ pull_request:
8
+ branches: [master]
9
+
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ ruby-version: ["2.6", "2.7", "3.0"]
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - name: Set up Ruby
19
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby-version }}
23
+ # runs 'bundle install' and caches installed gems automatically
24
+ bundler-cache: true
25
+ - name: Run tests
26
+ run: bundle exec rspec
27
+ audit:
28
+ runs-on: ubuntu-latest
29
+ steps:
30
+ - uses: actions/checkout@v2
31
+ - name: Set up Ruby
32
+ uses: ruby/setup-ruby@v1
33
+ with:
34
+ ruby-version: "3.0"
35
+ - name: Install bundle audit
36
+ run: gem install bundle-audit
37
+ - name: Update Ruby Advisory Database
38
+ run: bundle-audit update
39
+ - name: Run audit
40
+ run: bundle audit
data/Gemfile.lock CHANGED
@@ -1,55 +1,57 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eventboss (1.7.0)
4
+ eventboss (1.8.0)
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.1.1)
13
- aws-partitions (1.432.0)
14
- aws-sdk-core (3.113.0)
13
+ aws-eventstream (1.2.0)
14
+ aws-partitions (1.568.0)
15
+ aws-sdk-core (3.130.0)
15
16
  aws-eventstream (~> 1, >= 1.0.2)
16
- aws-partitions (~> 1, >= 1.239.0)
17
+ aws-partitions (~> 1, >= 1.525.0)
17
18
  aws-sigv4 (~> 1.1)
18
19
  jmespath (~> 1.0)
19
- aws-sdk-sns (1.37.0)
20
- aws-sdk-core (~> 3, >= 3.109.0)
20
+ aws-sdk-sns (1.53.0)
21
+ aws-sdk-core (~> 3, >= 3.127.0)
21
22
  aws-sigv4 (~> 1.1)
22
- aws-sdk-sqs (1.35.0)
23
- aws-sdk-core (~> 3, >= 3.109.0)
23
+ aws-sdk-sqs (1.51.0)
24
+ aws-sdk-core (~> 3, >= 3.127.0)
24
25
  aws-sigv4 (~> 1.1)
25
- aws-sigv4 (1.2.3)
26
+ aws-sigv4 (1.4.0)
26
27
  aws-eventstream (~> 1, >= 1.0.2)
27
- diff-lcs (1.3)
28
+ diff-lcs (1.5.0)
28
29
  dotenv (2.7.6)
29
- jmespath (1.4.0)
30
- rake (13.0.1)
31
- rspec (3.7.0)
32
- rspec-core (~> 3.7.0)
33
- rspec-expectations (~> 3.7.0)
34
- rspec-mocks (~> 3.7.0)
35
- rspec-core (3.7.0)
36
- rspec-support (~> 3.7.0)
37
- rspec-expectations (3.7.0)
30
+ jmespath (1.6.1)
31
+ rake (13.0.6)
32
+ rexml (3.2.5)
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.7.0)
40
- rspec-mocks (3.7.0)
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.7.0)
43
- rspec-support (3.7.0)
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 (~> 1.13)
51
+ bundler (>= 1)
50
52
  eventboss!
51
53
  rake (>= 10.0)
52
54
  rspec (~> 3.0)
53
55
 
54
56
  BUNDLED WITH
55
- 2.1.4
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:4575 # when using with localstack
104
- AWS_SQS_ENDPOINT=http://localhost:4576 # when using with localstack
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
  ```
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", "~> 1.13"
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 })
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Eventboss
2
- VERSION = "1.7.0"
2
+ VERSION = "1.8.0"
3
3
  end
@@ -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
- puts "[#{task.name}] Reloading #{queue_name}-deadletter (max: #{ max_messages }, batch: #{ batch_size })"
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
- puts "[#{task.name}] #{queue.url}"
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
- puts "[#{task.name}] Purging #{queue_name}-deadletter (max: #{ max_messages }, batch: #{ batch_size })"
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
- puts "[#{task.name}] #{queue.url}"
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.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AirHelp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-08 00:00:00.000000000 Z
11
+ date: 2022-03-17 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: bundler
62
+ name: rexml
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '1.13'
68
- type: :development
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: '1.13'
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,7 @@ executables:
108
122
  extensions: []
109
123
  extra_rdoc_files: []
110
124
  files:
125
+ - ".github/workflows/verify.yml"
111
126
  - ".gitignore"
112
127
  - ".rspec"
113
128
  - ".travis.yml"
@@ -173,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
188
  - !ruby/object:Gem::Version
174
189
  version: '0'
175
190
  requirements: []
176
- rubygems_version: 3.1.6
191
+ rubygems_version: 3.3.7
177
192
  signing_key:
178
193
  specification_version: 4
179
194
  summary: Eventboss Ruby Client.