qyu-queue-sqs 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +59 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +75 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/qyu/queue/sqs.rb +32 -0
- data/lib/qyu/queue/sqs/adapter.rb +120 -0
- data/lib/qyu/queue/sqs/configuration_validator.rb +92 -0
- data/lib/qyu/queue/sqs/logger.rb +10 -0
- data/lib/qyu/queue/sqs/version.rb +7 -0
- data/qyu-queue-sqs.gemspec +30 -0
- metadata +144 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4c8c94ece0cf89e8e90e02c176d6a6b96674d42b1c8dcff74585b0e86107fd02
|
4
|
+
data.tar.gz: 851f1165fc889b81d8db7034a6e04dac5672f1c190dac5056f6bb1af01138b0b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: db6a2a3a96975f372e39018d0adff51ae56b66d10ffe1ffb9d16afd62bfa7479a547e4941e12538a618ac9dfa5969667698b45e576948e0e1c9095c4f91166c0
|
7
|
+
data.tar.gz: a8f57dfd5ca5dd882eef7fb2bd6d3348381ba776e42f37ea1a102d8eeb8830608a2e7dd582bf92ec5846a07055eada9d0aae449bb9ab9920ffe2806fa987ce34
|
data/.gitignore
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
51
|
+
|
52
|
+
# rspec failure tracking
|
53
|
+
.rspec_status
|
54
|
+
|
55
|
+
Dockerfile
|
56
|
+
docker-compose.yml
|
57
|
+
.env
|
58
|
+
|
59
|
+
Gemfile.lock
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at me@zzet.org. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Andrew Kumanyaev
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# Qyu::Queue::SQS
|
2
|
+
|
3
|
+
[![Gem Version](https://img.shields.io/gem/v/qyu-queue-sqs.svg)](https://rubygems.org/gems/qyu-queue-sqs)
|
4
|
+
[![Build Status](https://travis-ci.org/FindHotel/qyu-queue-sqs.svg)](https://travis-ci.org/FindHotel/qyu-queue-sqs)
|
5
|
+
|
6
|
+
## Requirements:
|
7
|
+
|
8
|
+
* Ruby 2.4.0 or newer
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'qyu-queue-sqs'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install qyu-queue-sqs
|
25
|
+
|
26
|
+
## Configuration
|
27
|
+
|
28
|
+
To start using Qyu; you need a queue configuration and a state store configuration. Here's an example:
|
29
|
+
```ruby
|
30
|
+
require 'qyu'
|
31
|
+
require 'qyu/queue/sqs'
|
32
|
+
|
33
|
+
Qyu.configure(
|
34
|
+
queue: {
|
35
|
+
type: :sqs,
|
36
|
+
region: aws_region,
|
37
|
+
access_key_id: aws_access_key_id,
|
38
|
+
secret_access_key: aws_secret_access_key,
|
39
|
+
queue_prefix: queue_prefix, # example: production
|
40
|
+
# Optional
|
41
|
+
message_retention_period: 1_209_600,
|
42
|
+
message_visibility_timeout: 300,
|
43
|
+
maximum_message_size: 262_144
|
44
|
+
},
|
45
|
+
store: {
|
46
|
+
type: :memory
|
47
|
+
# Or one of the other production-ready queues available
|
48
|
+
# Check https://github.com/FindHotel/qyu/wiki/State-Stores
|
49
|
+
},
|
50
|
+
# optional Defaults to STDOUT
|
51
|
+
logger: Logger.new(STDOUT)
|
52
|
+
)
|
53
|
+
```
|
54
|
+
|
55
|
+
## Usage
|
56
|
+
|
57
|
+
TODO: Write usage instructions here
|
58
|
+
|
59
|
+
## Development
|
60
|
+
|
61
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
62
|
+
|
63
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
64
|
+
|
65
|
+
## Contributing
|
66
|
+
|
67
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/qyu-queue-sqs. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
68
|
+
|
69
|
+
## License
|
70
|
+
|
71
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
72
|
+
|
73
|
+
## Code of Conduct
|
74
|
+
|
75
|
+
Everyone interacting in the Qyu::Queue::SQS project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/qyu-queue-sqs/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "qyu/queue/sqs"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative "./sqs/version"
|
2
|
+
|
3
|
+
module Qyu
|
4
|
+
module Queue
|
5
|
+
module SQS
|
6
|
+
autoload :Adapter, 'qyu/queue/sqs/adapter'
|
7
|
+
autoload :ConfigurationValidator, 'qyu/queue/sqs/configuration_validator'
|
8
|
+
autoload :Logger, 'qyu/queue/sqs/logger'
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def interface
|
12
|
+
defined?(Qyu::MessageQueue::Base) ? Qyu::MessageQueue::Base : Object
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class << self
|
19
|
+
unless defined?(logger)
|
20
|
+
def logger=(logger)
|
21
|
+
@@__logger = logger
|
22
|
+
end
|
23
|
+
|
24
|
+
def logger
|
25
|
+
@@__logger ||= Qyu::Queue::SQS::Logger.new(STDOUT)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
Qyu::Config::QueueConfig.register(Qyu::Queue::SQS::Adapter) if defined?(Qyu::Config::QueueConfig)
|
32
|
+
Qyu::Factory::QueueFactory.register(Qyu::Queue::SQS::Adapter) if defined?(Qyu::Factory::QueueFactory)
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require 'aws-sdk-sqs'
|
2
|
+
require 'json'
|
3
|
+
require_relative '../sqs'
|
4
|
+
|
5
|
+
module Qyu
|
6
|
+
module Queue
|
7
|
+
module SQS
|
8
|
+
class Adapter < Qyu::Queue::SQS.interface
|
9
|
+
TYPE = :sqs
|
10
|
+
|
11
|
+
def initialize(config)
|
12
|
+
init_client(config)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.valid_config?(config)
|
16
|
+
ConfigurationValidator.new(config).valid?
|
17
|
+
end
|
18
|
+
|
19
|
+
def enqueue_task(queue_name, task_id)
|
20
|
+
response = @sqs.send_message({
|
21
|
+
queue_url: get_or_create_queue_url(queue_name),
|
22
|
+
message_body: { task_id: task_id }.to_json.to_s
|
23
|
+
})
|
24
|
+
|
25
|
+
Qyu.logger.debug "SQS response: #{response}"
|
26
|
+
Qyu.logger.info "Task enqueued with ID #{task_id} in queue #{queue_name}"
|
27
|
+
|
28
|
+
response
|
29
|
+
end
|
30
|
+
|
31
|
+
def enqueue_task_to_failed_queue(queue_name, task_id)
|
32
|
+
failed_queue_name = queue_name + '-failed'
|
33
|
+
enqueue_task(failed_queue_name, task_id)
|
34
|
+
end
|
35
|
+
|
36
|
+
def fetch_next_message(queue_name)
|
37
|
+
Qyu.logger.debug "Listening on `#{queue_name}`"
|
38
|
+
|
39
|
+
while (response = @sqs.receive_message({
|
40
|
+
queue_url: get_or_create_queue_url(queue_name),
|
41
|
+
max_number_of_messages: 1
|
42
|
+
})).messages.count == 0
|
43
|
+
|
44
|
+
sleep 1
|
45
|
+
end
|
46
|
+
|
47
|
+
message = response.messages[0]
|
48
|
+
|
49
|
+
Qyu.logger.debug "Fetched message #{message}"
|
50
|
+
|
51
|
+
{
|
52
|
+
'id' => message.receipt_handle,
|
53
|
+
'task_id' => JSON.parse(message.body)['task_id']
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
def acknowledge_message(queue_name, message_id)
|
58
|
+
@sqs.delete_message({
|
59
|
+
queue_url: get_or_create_queue_url(queue_name),
|
60
|
+
receipt_handle: message_id
|
61
|
+
})
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def get_or_create_queue_url(queue_name)
|
67
|
+
full_queue_name = "#{@queue_prefix}-#{queue_name}"
|
68
|
+
begin
|
69
|
+
response = @sqs.get_queue_url({
|
70
|
+
queue_name: full_queue_name
|
71
|
+
})
|
72
|
+
|
73
|
+
return response.queue_url
|
74
|
+
rescue Aws::SQS::Errors::NonExistentQueue
|
75
|
+
|
76
|
+
Qyu.logger.info "Could not find queue `#{full_queue_name}`, creating it"
|
77
|
+
|
78
|
+
response = @sqs.create_queue({
|
79
|
+
queue_name: full_queue_name,
|
80
|
+
attributes: @queue_attributes
|
81
|
+
})
|
82
|
+
|
83
|
+
response.queue_url
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# noinspection RubyArgCount
|
88
|
+
def init_client(config)
|
89
|
+
|
90
|
+
Qyu.logger.debug "Initializing SQS client with configuration #{config}"
|
91
|
+
|
92
|
+
@queue_prefix = config[:queue_prefix]
|
93
|
+
@sqs = Aws::SQS::Client.new(
|
94
|
+
region: config[:region],
|
95
|
+
access_key_id: config[:access_key_id],
|
96
|
+
secret_access_key: config[:secret_access_key]
|
97
|
+
)
|
98
|
+
@queue_attributes = queue_attributes(config)
|
99
|
+
end
|
100
|
+
|
101
|
+
def queue_attributes(config)
|
102
|
+
attrs = {}
|
103
|
+
if config[:message_visibility_timeout]
|
104
|
+
attrs['VisibilityTimeout'] = config[:message_visibility_timeout].to_s
|
105
|
+
end
|
106
|
+
|
107
|
+
if config[:message_retention_period]
|
108
|
+
attrs['MessageRetentionPeriod'] = config[:message_retention_period].to_s
|
109
|
+
end
|
110
|
+
|
111
|
+
if config[:maximum_message_size]
|
112
|
+
attrs['MaximumMessageSize'] = config[:maximum_message_size].to_s
|
113
|
+
end
|
114
|
+
|
115
|
+
attrs
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
module Qyu
|
2
|
+
module Queue
|
3
|
+
module SQS
|
4
|
+
class ConfigurationValidator
|
5
|
+
VALID_REGIONS = %w(
|
6
|
+
us-east-1 us-west-1 us-west-2 ca-central-1 ap-south-1
|
7
|
+
ap-northeast-2 ap-southeast-1 ap-southeast-2
|
8
|
+
ap-northeast-1 eu-central-1 eu-west-1 eu-west-2
|
9
|
+
sa-east-1
|
10
|
+
).freeze
|
11
|
+
|
12
|
+
attr_reader :errors
|
13
|
+
|
14
|
+
def initialize(config)
|
15
|
+
@config = config
|
16
|
+
@errors = []
|
17
|
+
end
|
18
|
+
|
19
|
+
def valid?
|
20
|
+
validate
|
21
|
+
@errors.empty?
|
22
|
+
end
|
23
|
+
|
24
|
+
def validate
|
25
|
+
validate_aws_region
|
26
|
+
validate_aws_access_key_id
|
27
|
+
validate_aws_secret_access_key
|
28
|
+
validate_queue_prefix
|
29
|
+
validate_message_visibility_timeout
|
30
|
+
validate_message_retention_period
|
31
|
+
validate_maximum_message_size
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def validate_queue_prefix
|
37
|
+
unless @config[:queue_prefix]
|
38
|
+
@errors << 'queue_prefix must be present.'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def validate_aws_region
|
43
|
+
unless @config[:region].present?
|
44
|
+
@errors << 'AWS region must be present.'
|
45
|
+
return
|
46
|
+
end
|
47
|
+
|
48
|
+
unless VALID_REGIONS.include?(@config[:region])
|
49
|
+
@errors << 'AWS region invalid.'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def validate_aws_access_key_id
|
54
|
+
if @config[:access_key_id].nil? || @config[:access_key_id].blank?
|
55
|
+
@errors << 'AWS access_key_id must be present.'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def validate_aws_secret_access_key
|
60
|
+
if @config[:secret_access_key].nil? || @config[:secret_access_key].blank?
|
61
|
+
@errors << 'AWS secret_access_key must be present.'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def validate_message_visibility_timeout
|
66
|
+
return unless @config[:message_visibility_timeout]
|
67
|
+
if @config[:message_visibility_timeout].to_i < 0 ||
|
68
|
+
@config[:message_visibility_timeout].to_i > 43_200
|
69
|
+
@errors << 'message_visibility_timeout should be between 0 and 43,200 seconds'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def validate_message_retention_period
|
74
|
+
return unless @config[:message_retention_period]
|
75
|
+
if @config[:message_retention_period].to_i < 60 ||
|
76
|
+
@config[:message_retention_period].to_i > 1_209_600
|
77
|
+
@errors << 'message_retention_period should be between 60 and 1,209,600 seconds'
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def validate_maximum_message_size
|
82
|
+
return unless @config[:maximum_message_size]
|
83
|
+
if @config[:maximum_message_size].to_i < 1_024 ||
|
84
|
+
@config[:maximum_message_size].to_i > 262_144
|
85
|
+
@errors << 'maximum_message_size should be between 1,024 and 262,144 bytes'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "qyu/queue/sqs/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "qyu-queue-sqs"
|
8
|
+
spec.version = Qyu::Queue::SQS::VERSION
|
9
|
+
spec.authors = ["Andrew Kumanyaev"]
|
10
|
+
spec.email = ["me@zzet.org"]
|
11
|
+
|
12
|
+
spec.summary = %q{Amazon SQS message queue for Qyu https://rubygems.org/gems/qyu}
|
13
|
+
spec.description = %q{Amazon SQS message queue for Qyu https://rubygems.org/gems/qyu}
|
14
|
+
spec.homepage = "https://github.com/FindHotel/qyu-queue-sqs"
|
15
|
+
spec.license = "MIT"
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "pry", "~> 0.11"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.5"
|
27
|
+
spec.add_development_dependency 'simplecov'
|
28
|
+
|
29
|
+
spec.add_runtime_dependency 'aws-sdk-sqs', '~> 1.3'
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: qyu-queue-sqs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew Kumanyaev
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.11'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.11'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.5'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.5'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: aws-sdk-sqs
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.3'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.3'
|
97
|
+
description: Amazon SQS message queue for Qyu https://rubygems.org/gems/qyu
|
98
|
+
email:
|
99
|
+
- me@zzet.org
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
|
+
- CODE_OF_CONDUCT.md
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/console
|
113
|
+
- bin/setup
|
114
|
+
- lib/qyu/queue/sqs.rb
|
115
|
+
- lib/qyu/queue/sqs/adapter.rb
|
116
|
+
- lib/qyu/queue/sqs/configuration_validator.rb
|
117
|
+
- lib/qyu/queue/sqs/logger.rb
|
118
|
+
- lib/qyu/queue/sqs/version.rb
|
119
|
+
- qyu-queue-sqs.gemspec
|
120
|
+
homepage: https://github.com/FindHotel/qyu-queue-sqs
|
121
|
+
licenses:
|
122
|
+
- MIT
|
123
|
+
metadata: {}
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options: []
|
126
|
+
require_paths:
|
127
|
+
- lib
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
requirements: []
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.7.4
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: Amazon SQS message queue for Qyu https://rubygems.org/gems/qyu
|
144
|
+
test_files: []
|