sidekiq-aws-sqs 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +169 -1
- data/README.md +40 -2
- data/lib/sidekiq/aws/sqs/helpers.rb +81 -0
- data/lib/sidekiq/aws/sqs/rails/engine.rb +25 -0
- data/lib/sidekiq/aws/sqs/version.rb +1 -1
- data/lib/sidekiq/aws/sqs/worker.rb +77 -0
- data/lib/sidekiq/aws/sqs.rb +15 -2
- metadata +82 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c672a08fbea53c439915d089a38d1a9d8a6cd6159fe8cf809dd66a3bbc946f2
|
4
|
+
data.tar.gz: '08e8905bdf9b926ef4485a110193b7ed553950f052b5cd4ca177212ac22b7766'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0d38d03c38eca397b52367c7a134f0455e5335e2ef81ef2beab84379696f5abcbc73c423c305da2c1fb5f336cebe2b48a21fbc96e4566c8eee9eef65e105fc9
|
7
|
+
data.tar.gz: 42990522018f2b536fc4e558f2b191d9d967281a54fdaea1f3da2f167a0a6759fcd5dfa9cc26fdbdf575dbef998f3b154bacd012925eb386f87920ef78f8ca1f
|
data/Gemfile.lock
CHANGED
@@ -1,25 +1,179 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sidekiq-aws-sqs (0.0.
|
4
|
+
sidekiq-aws-sqs (0.0.1)
|
5
|
+
aws-sdk-sqs (~> 1.53)
|
6
|
+
dry-configurable (~> 1.0, >= 1.0.1)
|
7
|
+
rails (>= 6.0.0)
|
8
|
+
safe_poller (~> 0.0.1)
|
9
|
+
sidekiq (>= 7.0.0)
|
5
10
|
|
6
11
|
GEM
|
7
12
|
remote: https://rubygems.org/
|
8
13
|
specs:
|
14
|
+
actioncable (7.0.4.3)
|
15
|
+
actionpack (= 7.0.4.3)
|
16
|
+
activesupport (= 7.0.4.3)
|
17
|
+
nio4r (~> 2.0)
|
18
|
+
websocket-driver (>= 0.6.1)
|
19
|
+
actionmailbox (7.0.4.3)
|
20
|
+
actionpack (= 7.0.4.3)
|
21
|
+
activejob (= 7.0.4.3)
|
22
|
+
activerecord (= 7.0.4.3)
|
23
|
+
activestorage (= 7.0.4.3)
|
24
|
+
activesupport (= 7.0.4.3)
|
25
|
+
mail (>= 2.7.1)
|
26
|
+
net-imap
|
27
|
+
net-pop
|
28
|
+
net-smtp
|
29
|
+
actionmailer (7.0.4.3)
|
30
|
+
actionpack (= 7.0.4.3)
|
31
|
+
actionview (= 7.0.4.3)
|
32
|
+
activejob (= 7.0.4.3)
|
33
|
+
activesupport (= 7.0.4.3)
|
34
|
+
mail (~> 2.5, >= 2.5.4)
|
35
|
+
net-imap
|
36
|
+
net-pop
|
37
|
+
net-smtp
|
38
|
+
rails-dom-testing (~> 2.0)
|
39
|
+
actionpack (7.0.4.3)
|
40
|
+
actionview (= 7.0.4.3)
|
41
|
+
activesupport (= 7.0.4.3)
|
42
|
+
rack (~> 2.0, >= 2.2.0)
|
43
|
+
rack-test (>= 0.6.3)
|
44
|
+
rails-dom-testing (~> 2.0)
|
45
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
46
|
+
actiontext (7.0.4.3)
|
47
|
+
actionpack (= 7.0.4.3)
|
48
|
+
activerecord (= 7.0.4.3)
|
49
|
+
activestorage (= 7.0.4.3)
|
50
|
+
activesupport (= 7.0.4.3)
|
51
|
+
globalid (>= 0.6.0)
|
52
|
+
nokogiri (>= 1.8.5)
|
53
|
+
actionview (7.0.4.3)
|
54
|
+
activesupport (= 7.0.4.3)
|
55
|
+
builder (~> 3.1)
|
56
|
+
erubi (~> 1.4)
|
57
|
+
rails-dom-testing (~> 2.0)
|
58
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
59
|
+
activejob (7.0.4.3)
|
60
|
+
activesupport (= 7.0.4.3)
|
61
|
+
globalid (>= 0.3.6)
|
62
|
+
activemodel (7.0.4.3)
|
63
|
+
activesupport (= 7.0.4.3)
|
64
|
+
activerecord (7.0.4.3)
|
65
|
+
activemodel (= 7.0.4.3)
|
66
|
+
activesupport (= 7.0.4.3)
|
67
|
+
activestorage (7.0.4.3)
|
68
|
+
actionpack (= 7.0.4.3)
|
69
|
+
activejob (= 7.0.4.3)
|
70
|
+
activerecord (= 7.0.4.3)
|
71
|
+
activesupport (= 7.0.4.3)
|
72
|
+
marcel (~> 1.0)
|
73
|
+
mini_mime (>= 1.1.0)
|
74
|
+
activesupport (7.0.4.3)
|
75
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
76
|
+
i18n (>= 1.6, < 2)
|
77
|
+
minitest (>= 5.1)
|
78
|
+
tzinfo (~> 2.0)
|
9
79
|
ast (2.4.2)
|
10
80
|
awesome_print (1.9.2)
|
81
|
+
aws-eventstream (1.2.0)
|
82
|
+
aws-partitions (1.749.0)
|
83
|
+
aws-sdk-core (3.171.0)
|
84
|
+
aws-eventstream (~> 1, >= 1.0.2)
|
85
|
+
aws-partitions (~> 1, >= 1.651.0)
|
86
|
+
aws-sigv4 (~> 1.5)
|
87
|
+
jmespath (~> 1, >= 1.6.1)
|
88
|
+
aws-sdk-sqs (1.53.0)
|
89
|
+
aws-sdk-core (~> 3, >= 3.165.0)
|
90
|
+
aws-sigv4 (~> 1.1)
|
91
|
+
aws-sigv4 (1.5.2)
|
92
|
+
aws-eventstream (~> 1, >= 1.0.2)
|
93
|
+
builder (3.2.4)
|
11
94
|
coderay (1.1.3)
|
95
|
+
concurrent-ruby (1.2.2)
|
96
|
+
connection_pool (2.4.0)
|
97
|
+
crass (1.0.6)
|
98
|
+
date (3.3.3)
|
12
99
|
diff-lcs (1.5.0)
|
100
|
+
dry-configurable (1.0.1)
|
101
|
+
dry-core (~> 1.0, < 2)
|
102
|
+
zeitwerk (~> 2.6)
|
103
|
+
dry-core (1.0.0)
|
104
|
+
concurrent-ruby (~> 1.0)
|
105
|
+
zeitwerk (~> 2.6)
|
106
|
+
erubi (1.12.0)
|
107
|
+
globalid (1.1.0)
|
108
|
+
activesupport (>= 5.0)
|
109
|
+
i18n (1.12.0)
|
110
|
+
concurrent-ruby (~> 1.0)
|
111
|
+
jmespath (1.6.2)
|
13
112
|
json (2.6.3)
|
113
|
+
loofah (2.20.0)
|
114
|
+
crass (~> 1.0.2)
|
115
|
+
nokogiri (>= 1.5.9)
|
116
|
+
mail (2.8.1)
|
117
|
+
mini_mime (>= 0.1.1)
|
118
|
+
net-imap
|
119
|
+
net-pop
|
120
|
+
net-smtp
|
121
|
+
marcel (1.0.2)
|
14
122
|
method_source (1.0.0)
|
123
|
+
mini_mime (1.1.2)
|
124
|
+
minitest (5.18.0)
|
125
|
+
net-imap (0.3.4)
|
126
|
+
date
|
127
|
+
net-protocol
|
128
|
+
net-pop (0.1.2)
|
129
|
+
net-protocol
|
130
|
+
net-protocol (0.2.1)
|
131
|
+
timeout
|
132
|
+
net-smtp (0.3.3)
|
133
|
+
net-protocol
|
134
|
+
nio4r (2.5.9)
|
135
|
+
nokogiri (1.14.3-arm64-darwin)
|
136
|
+
racc (~> 1.4)
|
15
137
|
parallel (1.23.0)
|
16
138
|
parser (3.2.2.0)
|
17
139
|
ast (~> 2.4.1)
|
18
140
|
pry (0.14.2)
|
19
141
|
coderay (~> 1.1)
|
20
142
|
method_source (~> 1.0)
|
143
|
+
racc (1.6.2)
|
144
|
+
rack (2.2.6.4)
|
145
|
+
rack-test (2.1.0)
|
146
|
+
rack (>= 1.3)
|
147
|
+
rails (7.0.4.3)
|
148
|
+
actioncable (= 7.0.4.3)
|
149
|
+
actionmailbox (= 7.0.4.3)
|
150
|
+
actionmailer (= 7.0.4.3)
|
151
|
+
actionpack (= 7.0.4.3)
|
152
|
+
actiontext (= 7.0.4.3)
|
153
|
+
actionview (= 7.0.4.3)
|
154
|
+
activejob (= 7.0.4.3)
|
155
|
+
activemodel (= 7.0.4.3)
|
156
|
+
activerecord (= 7.0.4.3)
|
157
|
+
activestorage (= 7.0.4.3)
|
158
|
+
activesupport (= 7.0.4.3)
|
159
|
+
bundler (>= 1.15.0)
|
160
|
+
railties (= 7.0.4.3)
|
161
|
+
rails-dom-testing (2.0.3)
|
162
|
+
activesupport (>= 4.2.0)
|
163
|
+
nokogiri (>= 1.6)
|
164
|
+
rails-html-sanitizer (1.5.0)
|
165
|
+
loofah (~> 2.19, >= 2.19.1)
|
166
|
+
railties (7.0.4.3)
|
167
|
+
actionpack (= 7.0.4.3)
|
168
|
+
activesupport (= 7.0.4.3)
|
169
|
+
method_source
|
170
|
+
rake (>= 12.2)
|
171
|
+
thor (~> 1.0)
|
172
|
+
zeitwerk (~> 2.5)
|
21
173
|
rainbow (3.1.1)
|
22
174
|
rake (13.0.6)
|
175
|
+
redis-client (0.14.1)
|
176
|
+
connection_pool
|
23
177
|
regexp_parser (2.8.0)
|
24
178
|
rexml (3.2.5)
|
25
179
|
rspec (3.12.0)
|
@@ -48,7 +202,21 @@ GEM
|
|
48
202
|
rubocop-ast (1.28.0)
|
49
203
|
parser (>= 3.2.1.0)
|
50
204
|
ruby-progressbar (1.13.0)
|
205
|
+
safe_poller (0.0.1)
|
206
|
+
sidekiq (7.0.9)
|
207
|
+
concurrent-ruby (< 2)
|
208
|
+
connection_pool (>= 2.3.0)
|
209
|
+
rack (>= 2.2.4)
|
210
|
+
redis-client (>= 0.11.0)
|
211
|
+
thor (1.2.1)
|
212
|
+
timeout (0.3.2)
|
213
|
+
tzinfo (2.0.6)
|
214
|
+
concurrent-ruby (~> 1.0)
|
51
215
|
unicode-display_width (2.4.2)
|
216
|
+
websocket-driver (0.7.5)
|
217
|
+
websocket-extensions (>= 0.1.0)
|
218
|
+
websocket-extensions (0.1.5)
|
219
|
+
zeitwerk (2.6.7)
|
52
220
|
|
53
221
|
PLATFORMS
|
54
222
|
arm64-darwin-22
|
data/README.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/sidekiq-aws-sqs.svg)](https://badge.fury.io/rb/sidekiq-aws-sqs)
|
2
|
+
![test](https://github.com/nejdetkadir/sidekiq-aws-sqs/actions/workflows/test.yml/badge.svg?branch=main)
|
3
|
+
![rubocop](https://github.com/nejdetkadir/sidekiq-aws-sqs/actions/workflows/rubocop.yml/badge.svg?branch=main)
|
4
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
|
5
|
+
![Ruby Version](https://img.shields.io/badge/ruby_version->=_2.7.0-blue.svg)
|
6
|
+
|
1
7
|
# Sidekiq::AWS::SQS
|
2
8
|
|
3
9
|
`sidekiq-aws-sqs` is a Sidekiq extension that simplifies the integration of AWS SQS queues with Sidekiq workers, by abstracting away the details of polling, processing and error handling of SQS messages. It aims to provide a reliable and flexible way to consume messages from SQS, while allowing the user to customize the polling behavior and SQS client options as needed.
|
@@ -33,14 +39,46 @@ class MyWorker
|
|
33
39
|
include Sidekiq::Worker
|
34
40
|
include Sidekiq::AWS::SQS::Worker
|
35
41
|
|
36
|
-
sqs_options queue_url: 'https://sqs.foo.amazonaws.com/123/bar',
|
42
|
+
sqs_options queue_url: 'https://sqs.foo.amazonaws.com/123/bar',
|
43
|
+
wait_time_seconds: 20, # optional, default: 20
|
44
|
+
destroy_on_received: true, # optional, default: false
|
45
|
+
max_number_of_messages: 10, # optional, default: 10
|
46
|
+
client: Aws::SQS::Client.new # optional if global config is set to Sidekiq::AWS::SQS.config.sqs_client
|
37
47
|
|
38
48
|
def perform(message)
|
39
|
-
|
49
|
+
body = JSON.parse(message, object_class: OpenStruct).body
|
50
|
+
|
51
|
+
puts "Received message: #{JSON.parse(body)}"
|
40
52
|
end
|
41
53
|
end
|
42
54
|
```
|
43
55
|
|
56
|
+
### Configuration
|
57
|
+
You can configure the global options for all sqs workers by creating an initializer file in `config/initializers/sidekiq_aws_sqs.rb` and setting the options as shown below.
|
58
|
+
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
# config/initializers/sidekiq_aws_sqs.rb
|
62
|
+
|
63
|
+
require 'sidekiq/aws/sqs'
|
64
|
+
require 'aws-sdk-sqs'
|
65
|
+
|
66
|
+
Sidekiq::AWS::SQS.configure do |config|
|
67
|
+
config.sqs_client = Aws::SQS::Client.new # global SQS client for all sqs workers
|
68
|
+
|
69
|
+
# you must set the your sqs workers here for registering them to sidekiq aws sqs
|
70
|
+
config.sqs_workers = [
|
71
|
+
MyWorker
|
72
|
+
]
|
73
|
+
|
74
|
+
# global polling options for all sqs workers
|
75
|
+
config.wait_time_seconds = 20 # optional, default: 20
|
76
|
+
config.destroy_on_received = true # optional, default: false
|
77
|
+
config.max_number_of_messages = 10 # optional, default: 10
|
78
|
+
config.logger = Sidekiq.logger # optional, default: Sidekiq.logger
|
79
|
+
end
|
80
|
+
```
|
81
|
+
|
44
82
|
## Contributing
|
45
83
|
|
46
84
|
Bug reports and pull requests are welcome on GitHub at https://github.com/nejdetkadir/sidekiq-aws-sqs. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/nejdetkadir/sidekiq-aws-sqs/blob/main/CODE_OF_CONDUCT.md).
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sidekiq
|
4
|
+
module AWS
|
5
|
+
module SQS
|
6
|
+
module Helpers
|
7
|
+
def validate_sqs_options!
|
8
|
+
raise ArgumentError, 'You must use the `sqs_options` method on your worker' if @sqs_options.blank?
|
9
|
+
|
10
|
+
if need_to_raise_for_queue_url?
|
11
|
+
raise ArgumentError,
|
12
|
+
'You must provide a SQS queue URL like `sqs_options queue_url: "url"'
|
13
|
+
end
|
14
|
+
|
15
|
+
raise ArgumentError, 'You must provide a SQS client' if need_to_raise_for_client?
|
16
|
+
|
17
|
+
if need_to_raise_for_wait_time_seconds?
|
18
|
+
raise ArgumentError,
|
19
|
+
'You must provide a valid wait time like `sqs_options wait_time_seconds: 20`'
|
20
|
+
end
|
21
|
+
if need_to_raise_for_max_number_of_messages?
|
22
|
+
raise ArgumentError,
|
23
|
+
'You must provide a valid max number of messages like `sqs_options max_number_of_messages: 10`'
|
24
|
+
end
|
25
|
+
|
26
|
+
return unless need_to_raise_for_destroy_on_received?
|
27
|
+
|
28
|
+
raise ArgumentError,
|
29
|
+
'You must provide a valid destroy on received like `sqs_options destroy_on_received: true`'
|
30
|
+
end
|
31
|
+
|
32
|
+
def sqs_options_struct
|
33
|
+
if @sqs_options[:wait_time_seconds].blank?
|
34
|
+
@sqs_options[:wait_time_seconds] =
|
35
|
+
Sidekiq::AWS::SQS.config.wait_time_seconds
|
36
|
+
end
|
37
|
+
|
38
|
+
if @sqs_options[:max_number_of_messages].blank?
|
39
|
+
@sqs_options[:max_number_of_messages] =
|
40
|
+
Sidekiq::AWS::SQS.config.max_number_of_messages
|
41
|
+
end
|
42
|
+
|
43
|
+
if @sqs_options[:destroy_on_received].blank?
|
44
|
+
@sqs_options[:destroy_on_received] =
|
45
|
+
Sidekiq::AWS::SQS.config.destroy_on_received
|
46
|
+
end
|
47
|
+
|
48
|
+
@sqs_options[:client] = Sidekiq::AWS::SQS.config.sqs_client if @sqs_options[:client].blank?
|
49
|
+
|
50
|
+
OpenStruct.new(@sqs_options)
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def need_to_raise_for_max_number_of_messages?
|
56
|
+
@sqs_options[:max_number_of_messages].present? && @sqs_options[:max_number_of_messages] > 10
|
57
|
+
end
|
58
|
+
|
59
|
+
def need_to_raise_for_wait_time_seconds?
|
60
|
+
@sqs_options[:wait_time_seconds].present? && @sqs_options[:wait_time_seconds] > 20
|
61
|
+
end
|
62
|
+
|
63
|
+
def need_to_raise_for_client?
|
64
|
+
Sidekiq::AWS::SQS.config.sqs_client.blank? && @sqs_options[:client].blank?
|
65
|
+
end
|
66
|
+
|
67
|
+
def need_to_raise_for_queue_url?
|
68
|
+
@sqs_options[:queue_url].blank?
|
69
|
+
end
|
70
|
+
|
71
|
+
def need_to_raise_for_destroy_on_received?
|
72
|
+
@sqs_options[:destroy_on_received].present? && !@sqs_options[:destroy_on_received].in?([true, false])
|
73
|
+
end
|
74
|
+
|
75
|
+
def need_to_destroy_on_received?
|
76
|
+
@sqs_options[:destroy_on_received] == true
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sidekiq
|
4
|
+
module AWS
|
5
|
+
module SQS
|
6
|
+
module Rails
|
7
|
+
class Engine < ::Rails::Engine
|
8
|
+
isolate_namespace Sidekiq::AWS::SQS
|
9
|
+
|
10
|
+
config.after_initialize do
|
11
|
+
::Sidekiq.configure_server do |config|
|
12
|
+
config.on(:shutdown) do
|
13
|
+
::Sidekiq::AWS::SQS.config.sqs_workers.each(&:stop_polling)
|
14
|
+
end
|
15
|
+
|
16
|
+
config.on(:startup) do
|
17
|
+
::Sidekiq::AWS::SQS.config.sqs_workers.each(&:start_polling)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'sidekiq/aws/sqs/helpers'
|
4
|
+
|
5
|
+
# rubocop:disable Layout/LineLength, Metrics/AbcSize
|
6
|
+
module Sidekiq
|
7
|
+
module AWS
|
8
|
+
module SQS
|
9
|
+
module Worker
|
10
|
+
include Sidekiq::AWS::SQS::Helpers
|
11
|
+
|
12
|
+
def poller
|
13
|
+
validate_sqs_options!
|
14
|
+
|
15
|
+
@poller ||= SafePoller.poll do
|
16
|
+
sqs_options_struct
|
17
|
+
.client
|
18
|
+
.receive_message(queue_url: sqs_options_struct.queue_url,
|
19
|
+
wait_time_seconds: sqs_options_struct.wait_time_seconds)
|
20
|
+
.messages
|
21
|
+
.each do |message|
|
22
|
+
Sidekiq::AWS::SQS.logger.debug("Received message #{message.message_id} from #{sqs_options_struct.queue_url} for #{self}")
|
23
|
+
|
24
|
+
perform_async(message.to_json)
|
25
|
+
|
26
|
+
Sidekiq::AWS::SQS.logger.debug("Enqueued message #{message.message_id} from #{sqs_options_struct.queue_url} for #{self}")
|
27
|
+
|
28
|
+
next unless need_to_destroy_on_received?
|
29
|
+
|
30
|
+
sqs_options_struct.client.delete_message(queue_url: sqs_options_struct.queue_url,
|
31
|
+
receipt_handle: message.receipt_handle)
|
32
|
+
|
33
|
+
Sidekiq::AWS::SQS.logger.debug("Deleted message #{message.message_id} from #{sqs_options_struct.queue_url} for #{self}")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def start_polling
|
39
|
+
Sidekiq::AWS::SQS.logger.debug("Starting polling for #{self}")
|
40
|
+
|
41
|
+
@poller&.start || poller
|
42
|
+
end
|
43
|
+
|
44
|
+
def stop_polling
|
45
|
+
Sidekiq::AWS::SQS.logger.debug("Stopping polling for #{self}")
|
46
|
+
|
47
|
+
@poller&.stop
|
48
|
+
end
|
49
|
+
|
50
|
+
def pause_polling
|
51
|
+
Sidekiq::AWS::SQS.logger.debug("Pausing polling for #{self}")
|
52
|
+
|
53
|
+
@poller&.pause
|
54
|
+
end
|
55
|
+
|
56
|
+
def resume_polling
|
57
|
+
Sidekiq::AWS::SQS.logger.debug("Resuming polling for #{self}")
|
58
|
+
|
59
|
+
@poller&.resume
|
60
|
+
end
|
61
|
+
|
62
|
+
def running?
|
63
|
+
@poller&.running? || false
|
64
|
+
end
|
65
|
+
|
66
|
+
def paused?
|
67
|
+
@poller&.paused? || false
|
68
|
+
end
|
69
|
+
|
70
|
+
def sqs_options(**options)
|
71
|
+
@sqs_options = options || {}
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
# rubocop:enable Layout/LineLength, Metrics/AbcSize
|
data/lib/sidekiq/aws/sqs.rb
CHANGED
@@ -1,12 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'sqs/version'
|
4
|
+
require 'rails'
|
5
|
+
require 'aws-sdk-sqs'
|
6
|
+
require 'sidekiq'
|
7
|
+
require 'dry-configurable'
|
4
8
|
|
5
9
|
module Sidekiq
|
6
10
|
module AWS
|
7
11
|
module SQS
|
8
|
-
|
9
|
-
|
12
|
+
extend Dry::Configurable
|
13
|
+
|
14
|
+
setting :sqs_client, default: nil, reader: true
|
15
|
+
setting :sqs_workers, default: [], reader: true
|
16
|
+
setting :wait_time_seconds, default: 20, reader: true
|
17
|
+
setting :max_number_of_messages, default: 10, reader: true
|
18
|
+
setting :destroy_on_received, default: false, reader: true
|
19
|
+
setting :logger, default: ::Sidekiq.logger, reader: true
|
10
20
|
end
|
11
21
|
end
|
12
22
|
end
|
23
|
+
|
24
|
+
require_relative 'sqs/rails/engine'
|
25
|
+
require_relative 'sqs/worker'
|
metadata
CHANGED
@@ -1,15 +1,91 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-aws-sqs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nejdetkadir
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
12
|
-
dependencies:
|
11
|
+
date: 2023-04-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aws-sdk-sqs
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.53'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.53'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dry-configurable
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 1.0.1
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.0'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.0.1
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rails
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 6.0.0
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 6.0.0
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: safe_poller
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 0.0.1
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 0.0.1
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: sidekiq
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 7.0.0
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 7.0.0
|
13
89
|
description: sidekiq-aws-sqs is a Sidekiq extension that provides an easy way to poll
|
14
90
|
and process messages from AWS SQS (Simple Queue Service) queues within a Sidekiq
|
15
91
|
worker. It uses the SafePoller gem under the hood to safely poll messages at a specified
|
@@ -32,7 +108,10 @@ files:
|
|
32
108
|
- README.md
|
33
109
|
- Rakefile
|
34
110
|
- lib/sidekiq/aws/sqs.rb
|
111
|
+
- lib/sidekiq/aws/sqs/helpers.rb
|
112
|
+
- lib/sidekiq/aws/sqs/rails/engine.rb
|
35
113
|
- lib/sidekiq/aws/sqs/version.rb
|
114
|
+
- lib/sidekiq/aws/sqs/worker.rb
|
36
115
|
- sig/sidekiq/aws/sqs.rbs
|
37
116
|
homepage: https://github.com/nejdetkadir/sidekiq-aws-sqs
|
38
117
|
licenses:
|