maitredee 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +63 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +103 -0
- data/LICENSE.txt +21 -0
- data/README.md +48 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/maitredee +4 -0
- data/lib/maitredee/adapters/sns_sqs_adapter.rb +214 -0
- data/lib/maitredee/adapters/test_adapter.rb +20 -0
- data/lib/maitredee/cli/runner.rb +108 -0
- data/lib/maitredee/publisher.rb +59 -0
- data/lib/maitredee/subscriber.rb +86 -0
- data/lib/maitredee/version.rb +3 -0
- data/lib/maitredee.rb +146 -0
- data/maitredee.gemspec +41 -0
- metadata +262 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 61c0a06dbc74d0d8206292b36bf2d070573c040ca344bb264c044641b4f4048f
|
4
|
+
data.tar.gz: 813e22cd0eb1f0ce3561d64215b5f62380cb16c19b5ff6552b9943a169c2c07f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c278cbf658d03041c875a7197e71faad91dccf0733e3dfe301316a45a635f533c53eb1444f1ed031ec10b508fb233e73d205bc7c8d8b0b5fc5d64384c06db6e4
|
7
|
+
data.tar.gz: 0e75c930e921ed82a4b9dc45f3e1dc329167e16be5cd425e84f604f5a1214ec365cb55fc5bc43783d8be8cad2bd0ad1e2256792cb6b9ff849b12357a19ff71bb
|
@@ -0,0 +1,63 @@
|
|
1
|
+
reference:
|
2
|
+
bundle_path: &bundle_path
|
3
|
+
vendor/bundle
|
4
|
+
|
5
|
+
restore_repo: &restore_repo
|
6
|
+
restore_cache:
|
7
|
+
name: Restore repo cache
|
8
|
+
keys:
|
9
|
+
- v1-repo-{{ .Branch }}-{{ .Revision }}
|
10
|
+
- v1-repo-{{ .Branch }}
|
11
|
+
- v1-repo-master
|
12
|
+
|
13
|
+
gems_cache_key: &gems_cache_key
|
14
|
+
v1-gem-cache-{{ arch }}-{{ checksum "Gemfile.lock" }}
|
15
|
+
|
16
|
+
restore_gems: &restore_gems
|
17
|
+
restore_cache:
|
18
|
+
name: Restore gem cache
|
19
|
+
keys:
|
20
|
+
- *gems_cache_key
|
21
|
+
- v1-gem-cache-{{ arch }}
|
22
|
+
|
23
|
+
defaults: &defaults
|
24
|
+
version: 2
|
25
|
+
jobs:
|
26
|
+
rspec:
|
27
|
+
working_directory: ~/maitredee
|
28
|
+
docker:
|
29
|
+
- image: circleci/ruby:2.5.1
|
30
|
+
environment: &docker_ruby_env
|
31
|
+
RACK_ENV: test
|
32
|
+
RAILS_ENV: test
|
33
|
+
BUNDLE_PATH: *bundle_path
|
34
|
+
CIRCLE_TEST_REPORTS: "/tmp/test-results"
|
35
|
+
CIRCLE_ARTIFACTS: "/tmp/test-results"
|
36
|
+
steps:
|
37
|
+
- *restore_repo
|
38
|
+
- *restore_gems
|
39
|
+
- checkout
|
40
|
+
- save_cache:
|
41
|
+
name: Save repo cache
|
42
|
+
key: v1-repo-{{ .Branch }}-{{ .Revision }}
|
43
|
+
paths: .
|
44
|
+
|
45
|
+
- run: bundle install --jobs=4 --retry=3 --frozen
|
46
|
+
- save_cache:
|
47
|
+
name: Save gem cache
|
48
|
+
key: *gems_cache_key
|
49
|
+
paths: *bundle_path
|
50
|
+
|
51
|
+
- run:
|
52
|
+
name: run rspec tests
|
53
|
+
command: |
|
54
|
+
bundle exec rspec --format progress
|
55
|
+
- run:
|
56
|
+
name: run sns/sqs tests
|
57
|
+
command: |
|
58
|
+
INTEGRATION_TEST=sns_sqs bundle exec rspec --format progress
|
59
|
+
workflows:
|
60
|
+
version: 2
|
61
|
+
build_and_test:
|
62
|
+
jobs:
|
63
|
+
- rspec
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.3
|
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 chrisschalago@gmail.com. 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/Gemfile.lock
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
maitredee (0.8.0)
|
5
|
+
activejob
|
6
|
+
activesupport
|
7
|
+
aws-sdk-sns
|
8
|
+
aws-sdk-sqs
|
9
|
+
json_schemer (~> 0.1.8)
|
10
|
+
shoryuken (>= 4.0)
|
11
|
+
thor
|
12
|
+
|
13
|
+
GEM
|
14
|
+
remote: https://rubygems.org/
|
15
|
+
specs:
|
16
|
+
activejob (5.2.2)
|
17
|
+
activesupport (= 5.2.2)
|
18
|
+
globalid (>= 0.3.6)
|
19
|
+
activesupport (5.2.2)
|
20
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
21
|
+
i18n (>= 0.7, < 2)
|
22
|
+
minitest (~> 5.1)
|
23
|
+
tzinfo (~> 1.1)
|
24
|
+
aws-eventstream (1.0.1)
|
25
|
+
aws-partitions (1.122.0)
|
26
|
+
aws-sdk-core (3.43.0)
|
27
|
+
aws-eventstream (~> 1.0)
|
28
|
+
aws-partitions (~> 1.0)
|
29
|
+
aws-sigv4 (~> 1.0)
|
30
|
+
jmespath (~> 1.0)
|
31
|
+
aws-sdk-sns (1.9.0)
|
32
|
+
aws-sdk-core (~> 3, >= 3.39.0)
|
33
|
+
aws-sigv4 (~> 1.0)
|
34
|
+
aws-sdk-sqs (1.10.0)
|
35
|
+
aws-sdk-core (~> 3, >= 3.39.0)
|
36
|
+
aws-sigv4 (~> 1.0)
|
37
|
+
aws-sigv4 (1.0.3)
|
38
|
+
byebug (10.0.2)
|
39
|
+
coderay (1.1.2)
|
40
|
+
concurrent-ruby (1.1.3)
|
41
|
+
diff-lcs (1.3)
|
42
|
+
dotenv (2.5.0)
|
43
|
+
ecma-re-validator (0.2.0)
|
44
|
+
regexp_parser (~> 1.2)
|
45
|
+
globalid (0.4.1)
|
46
|
+
activesupport (>= 4.2.0)
|
47
|
+
hana (1.3.4)
|
48
|
+
i18n (1.1.1)
|
49
|
+
concurrent-ruby (~> 1.0)
|
50
|
+
jmespath (1.4.0)
|
51
|
+
json_schemer (0.1.9)
|
52
|
+
ecma-re-validator (~> 0.2.0)
|
53
|
+
hana (~> 1.3.3)
|
54
|
+
regexp_parser (~> 1.2.0)
|
55
|
+
uri_template (~> 0.7.0)
|
56
|
+
method_source (0.9.2)
|
57
|
+
minitest (5.11.3)
|
58
|
+
pry (0.12.2)
|
59
|
+
coderay (~> 1.1.0)
|
60
|
+
method_source (~> 0.9.0)
|
61
|
+
pry-byebug (3.6.0)
|
62
|
+
byebug (~> 10.0)
|
63
|
+
pry (~> 0.10)
|
64
|
+
rake (10.5.0)
|
65
|
+
regexp_parser (1.2.0)
|
66
|
+
rspec (3.8.0)
|
67
|
+
rspec-core (~> 3.8.0)
|
68
|
+
rspec-expectations (~> 3.8.0)
|
69
|
+
rspec-mocks (~> 3.8.0)
|
70
|
+
rspec-core (3.8.0)
|
71
|
+
rspec-support (~> 3.8.0)
|
72
|
+
rspec-expectations (3.8.2)
|
73
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
74
|
+
rspec-support (~> 3.8.0)
|
75
|
+
rspec-mocks (3.8.0)
|
76
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
77
|
+
rspec-support (~> 3.8.0)
|
78
|
+
rspec-support (3.8.0)
|
79
|
+
shoryuken (4.0.2)
|
80
|
+
aws-sdk-core (>= 2)
|
81
|
+
concurrent-ruby
|
82
|
+
thor
|
83
|
+
thor (0.20.3)
|
84
|
+
thread_safe (0.3.6)
|
85
|
+
tzinfo (1.2.5)
|
86
|
+
thread_safe (~> 0.1)
|
87
|
+
uri_template (0.7.0)
|
88
|
+
|
89
|
+
PLATFORMS
|
90
|
+
ruby
|
91
|
+
|
92
|
+
DEPENDENCIES
|
93
|
+
bundler (~> 1.17)
|
94
|
+
dotenv
|
95
|
+
maitredee!
|
96
|
+
pry
|
97
|
+
pry-byebug
|
98
|
+
rake (~> 10.0)
|
99
|
+
rspec (~> 3.0)
|
100
|
+
rspec-mocks (~> 3.0)
|
101
|
+
|
102
|
+
BUNDLED WITH
|
103
|
+
1.17.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Chris Schalago
|
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,48 @@
|
|
1
|
+
# Maitredee
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/maitredee`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'maitredee'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install maitredee
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Todo
|
28
|
+
|
29
|
+
* split into publisher/subscriber sub gems with monorepo
|
30
|
+
* subscriber schema validation
|
31
|
+
|
32
|
+
## Development
|
33
|
+
|
34
|
+
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.
|
35
|
+
|
36
|
+
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).
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/maitredee. 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.
|
41
|
+
|
42
|
+
## License
|
43
|
+
|
44
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
45
|
+
|
46
|
+
## Code of Conduct
|
47
|
+
|
48
|
+
Everyone interacting in the Maitredee project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/maitredee/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 "maitredee"
|
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
data/exe/maitredee
ADDED
@@ -0,0 +1,214 @@
|
|
1
|
+
require "aws-sdk-sns"
|
2
|
+
require "aws-sdk-sqs"
|
3
|
+
|
4
|
+
module Maitredee
|
5
|
+
module Adapters
|
6
|
+
class SnsSqsAdapter
|
7
|
+
attr_reader :access_key_id, :secret_access_key, :region
|
8
|
+
|
9
|
+
def initialize(access_key_id: nil, secret_access_key: nil, region: nil, default_shoryuken_options: nil)
|
10
|
+
@access_key_id = access_key_id || ENV["MAITREDEE_AWS_ACCESS_KEY_ID"]
|
11
|
+
@secret_access_key = secret_access_key || ENV["MAITREDEE_AWS_SECRET_ACCESS_KEY"]
|
12
|
+
@region = region || ENV["MAITREDEE_AWS_REGION"]
|
13
|
+
@default_shoryuken_options = default_shoryuken_options
|
14
|
+
|
15
|
+
Shoryuken.sqs_client = sqs_client
|
16
|
+
end
|
17
|
+
|
18
|
+
def publish(message)
|
19
|
+
message_attributes = {
|
20
|
+
message_id: message.message_id,
|
21
|
+
topic_name: message.topic_name,
|
22
|
+
event_name: message.event_name,
|
23
|
+
primary_key: message.primary_key,
|
24
|
+
schema_name: message.schema_name,
|
25
|
+
maitredee_version: Maitredee::VERSION
|
26
|
+
}.compact
|
27
|
+
|
28
|
+
sns_client.publish(
|
29
|
+
topic_arn: topics[message.topic_resource_name].arn,
|
30
|
+
message: message.body.to_json,
|
31
|
+
message_attributes: sns_message_attributes(message_attributes)
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
def configure_broker(config)
|
36
|
+
config.each do |topic_resource_name, queue_resource_names|
|
37
|
+
queue_resource_names.each do |queue_resource_name|
|
38
|
+
subscribe(
|
39
|
+
topic_resource_name: topic_resource_name,
|
40
|
+
queue_resource_name: queue_resource_name
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def topics
|
47
|
+
@topics ||= Hash.new do |hash, key|
|
48
|
+
topic = sns_client.create_topic(
|
49
|
+
name: key
|
50
|
+
)
|
51
|
+
hash[key] = Aws::SNS::Topic.new(topic.topic_arn, client: sns_client)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def queues
|
56
|
+
@queues ||= Hash.new do |hash, key|
|
57
|
+
queue_url = sqs_client.create_queue(queue_name: key).queue_url
|
58
|
+
hash[key] = Aws::SQS::Queue.new(queue_url, client: sqs_client)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def subscriptions
|
63
|
+
@subscriptions ||= {}
|
64
|
+
end
|
65
|
+
|
66
|
+
def subscribe(queue_resource_name:, topic_resource_name:)
|
67
|
+
topic = topics[topic_resource_name]
|
68
|
+
queue = queues[queue_resource_name]
|
69
|
+
queue_arn = queue.attributes["QueueArn"]
|
70
|
+
|
71
|
+
resp = sns_client.subscribe(
|
72
|
+
topic_arn: topic.arn,
|
73
|
+
protocol: "sqs",
|
74
|
+
endpoint: queue_arn,
|
75
|
+
attributes: { "RawMessageDelivery" => "true" }
|
76
|
+
)
|
77
|
+
|
78
|
+
subscriptions[resp.subscription_arn] =
|
79
|
+
Aws::SNS::Subscription.new(resp.subscription_arn, client: sns_client)
|
80
|
+
|
81
|
+
queue.set_attributes(
|
82
|
+
attributes: {
|
83
|
+
"Policy" => sqs_policy(
|
84
|
+
queue_arn: queue_arn,
|
85
|
+
topic_arn: topic.arn
|
86
|
+
)
|
87
|
+
}
|
88
|
+
)
|
89
|
+
end
|
90
|
+
|
91
|
+
def add_worker(subscriber_class)
|
92
|
+
worker_name = "#{subscriber_class.name}Worker"
|
93
|
+
worker_class = self.class.const_defined?(worker_name)
|
94
|
+
unless worker_class
|
95
|
+
worker_class = Class.new(Worker)
|
96
|
+
worker_class.shoryuken_options default_shoryuken_options.merge(
|
97
|
+
queue: subscriber_class.queue_resource_name
|
98
|
+
)
|
99
|
+
worker_class.subscriber_class = subscriber_class
|
100
|
+
self.class.const_set worker_name, worker_class
|
101
|
+
end
|
102
|
+
worker_class
|
103
|
+
end
|
104
|
+
|
105
|
+
def default_shoryuken_options
|
106
|
+
@default_shoryuken_options ||= {
|
107
|
+
body_parser: :json,
|
108
|
+
auto_delete: true
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
def reset
|
113
|
+
[topics, queues, subscriptions].each do |resource|
|
114
|
+
resource.values.each(&:delete)
|
115
|
+
resource.clear
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
private
|
120
|
+
|
121
|
+
def sns_client
|
122
|
+
@sns_client ||= new_client(Aws::SNS::Client)
|
123
|
+
end
|
124
|
+
|
125
|
+
def sqs_client
|
126
|
+
@sqs_client ||= new_client(Aws::SQS::Client)
|
127
|
+
end
|
128
|
+
|
129
|
+
def new_client(klass)
|
130
|
+
options = {}
|
131
|
+
|
132
|
+
if access_key_id && secret_access_key
|
133
|
+
options.merge!(
|
134
|
+
access_key_id: access_key_id,
|
135
|
+
secret_access_key: secret_access_key
|
136
|
+
)
|
137
|
+
end
|
138
|
+
|
139
|
+
options[:region] = region if region
|
140
|
+
|
141
|
+
klass.new(options)
|
142
|
+
end
|
143
|
+
|
144
|
+
def sns_message_attributes(hash)
|
145
|
+
hash.compact.each_with_object({}) do |(key, val), new_hash|
|
146
|
+
new_hash[key.to_s] = {
|
147
|
+
data_type: "String",
|
148
|
+
string_value: val
|
149
|
+
}
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def sqs_policy(queue_arn:, topic_arn:)
|
154
|
+
<<~POLICY
|
155
|
+
{
|
156
|
+
"Version": "2008-10-17",
|
157
|
+
"Id": "#{queue_arn}/SQSDefaultPolicy",
|
158
|
+
"Statement": [
|
159
|
+
{
|
160
|
+
"Sid": "#{queue_arn}-Sid",
|
161
|
+
"Effect": "Allow",
|
162
|
+
"Principal": {
|
163
|
+
"AWS": "*"
|
164
|
+
},
|
165
|
+
"Action": "SQS:*",
|
166
|
+
"Resource": "#{queue_arn}",
|
167
|
+
"Condition": {
|
168
|
+
"StringEquals": {
|
169
|
+
"aws:SourceArn": "#{topic_arn}"
|
170
|
+
}
|
171
|
+
}
|
172
|
+
}
|
173
|
+
]
|
174
|
+
}
|
175
|
+
POLICY
|
176
|
+
end
|
177
|
+
|
178
|
+
class Worker
|
179
|
+
include Shoryuken::Worker
|
180
|
+
|
181
|
+
class << self
|
182
|
+
attr_accessor :subscriber_class
|
183
|
+
end
|
184
|
+
|
185
|
+
MESSAGE_KEYS = %w[
|
186
|
+
event_name
|
187
|
+
maitredee_version
|
188
|
+
primary_key
|
189
|
+
schema_name
|
190
|
+
topic_name
|
191
|
+
].freeze
|
192
|
+
|
193
|
+
def perform(sqs_message, body)
|
194
|
+
attributes = MESSAGE_KEYS.each_with_object({}) do |key, hash|
|
195
|
+
hash[key.to_sym] = sqs_message.message_attributes[key]&.string_value
|
196
|
+
end
|
197
|
+
|
198
|
+
attributes.merge!(
|
199
|
+
adapter_message: sqs_message,
|
200
|
+
body: body,
|
201
|
+
broker_message_id: sqs_message.message_id,
|
202
|
+
message_id: sqs_message.message_id,
|
203
|
+
raw_message: sqs_message.body,
|
204
|
+
sent_at: Time.at(sqs_message.attributes["SentTimestamp"].to_i)
|
205
|
+
)
|
206
|
+
|
207
|
+
subscriber_message = SubscriberMessage.new(attributes)
|
208
|
+
|
209
|
+
self.class.subscriber_class.process(subscriber_message)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Maitredee
|
2
|
+
module Adapters
|
3
|
+
class TestAdapter
|
4
|
+
def publish(message)
|
5
|
+
messages << message
|
6
|
+
end
|
7
|
+
|
8
|
+
def messages
|
9
|
+
@messages ||= []
|
10
|
+
end
|
11
|
+
|
12
|
+
def add_worker(subscriber_class)
|
13
|
+
end
|
14
|
+
|
15
|
+
def reset
|
16
|
+
messages.clear
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "shoryuken/runner"
|
3
|
+
|
4
|
+
module Maitredee
|
5
|
+
module CLI
|
6
|
+
class Runner < Thor
|
7
|
+
default_task :start
|
8
|
+
|
9
|
+
desc 'start', 'Starts Maitredee'
|
10
|
+
method_option :concurrency, aliases: '-c', type: :numeric, desc: 'Processor threads to use'
|
11
|
+
method_option :daemon, aliases: '-d', type: :boolean, desc: 'Daemonize process'
|
12
|
+
method_option :subscribers, aliases: '-s', type: :array, desc: 'Subscribers to process with optional weights'
|
13
|
+
method_option :require, aliases: '-r', type: :string, desc: 'Dir or path of the subscribers'
|
14
|
+
method_option :timeout, aliases: '-t', type: :numeric, desc: 'Hard shutdown timeout'
|
15
|
+
method_option :config, aliases: '-C', type: :string, desc: 'Path to config file'
|
16
|
+
method_option :config_file, type: :string, desc: 'Path to config file (backwards compatibility)'
|
17
|
+
method_option :rails, aliases: '-R', type: :boolean, desc: 'Load Rails'
|
18
|
+
method_option :logfile, aliases: '-L', type: :string, desc: 'Path to logfile'
|
19
|
+
method_option :pidfile, aliases: '-P', type: :string, desc: 'Path to pidfile'
|
20
|
+
method_option :verbose, aliases: '-v', type: :boolean, desc: 'Print more verbose output'
|
21
|
+
method_option :delay, aliases: '-D', type: :numeric, desc: 'Number of seconds to pause fetching from an empty queue'
|
22
|
+
def start
|
23
|
+
opts = options.to_h.symbolize_keys
|
24
|
+
|
25
|
+
say '[DEPRECATED] Please use --config instead of --config-file', :yellow if opts[:config_file]
|
26
|
+
|
27
|
+
opts[:config_file] = opts.delete(:config) if opts[:config]
|
28
|
+
|
29
|
+
if opts[:rails]
|
30
|
+
opts.delete(:rails)
|
31
|
+
load_rails
|
32
|
+
end
|
33
|
+
|
34
|
+
if opts[:require]
|
35
|
+
require_workers(opts.delete(:require))
|
36
|
+
end
|
37
|
+
|
38
|
+
if opts[:config_file]
|
39
|
+
path = opts.delete(:config_file)
|
40
|
+
fail ArgumentError, "The supplied config file #{path} does not exist" unless File.exist?(path)
|
41
|
+
|
42
|
+
if (result = YAML.load(ERB.new(IO.read(path)).result))
|
43
|
+
file = Tempfile.new(['maitredee-to-shoryuken', '.yml'])
|
44
|
+
|
45
|
+
result.deep_symbolize_keys!
|
46
|
+
if result[:subscribers]
|
47
|
+
subscribers = result.delete(:subscribers)
|
48
|
+
result[:queues] = subscribers.map(&:constantize).map(&:queue_resource_name)
|
49
|
+
end
|
50
|
+
|
51
|
+
file.write(YAML.dump(result))
|
52
|
+
file.flush
|
53
|
+
|
54
|
+
opts[:config_file] = file.path
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
if opts[:subscribers]
|
59
|
+
opts[:queues] = opts.delete(:subscribers).map(&:constantize).map(&:queue_resource_name)
|
60
|
+
end
|
61
|
+
|
62
|
+
fail_task "You should set a logfile if you're going to daemonize" if opts[:daemon] && opts[:logfile].nil?
|
63
|
+
|
64
|
+
Shoryuken::Runner.instance.run(opts.freeze)
|
65
|
+
|
66
|
+
opts
|
67
|
+
end
|
68
|
+
|
69
|
+
desc 'version', 'Prints version'
|
70
|
+
def version
|
71
|
+
say "Maitredee #{Maitredee::VERSION}"
|
72
|
+
say "Shoryuken #{Shoryuken::VERSION}"
|
73
|
+
end
|
74
|
+
|
75
|
+
no_commands do
|
76
|
+
def load_rails
|
77
|
+
# Adapted from: https://github.com/mperham/sidekiq/blob/master/lib/sidekiq/cli.rb
|
78
|
+
|
79
|
+
require 'rails'
|
80
|
+
if ::Rails::VERSION::MAJOR < 4
|
81
|
+
require File.expand_path('config/environment.rb')
|
82
|
+
::Rails.application.eager_load!
|
83
|
+
else
|
84
|
+
# Painful contortions, see 1791 for discussion
|
85
|
+
require File.expand_path('config/application.rb')
|
86
|
+
if ::Rails::VERSION::MAJOR == 4
|
87
|
+
::Rails::Application.initializer 'maitredee.eager_load' do
|
88
|
+
::Rails.application.config.eager_load = true
|
89
|
+
end
|
90
|
+
end
|
91
|
+
require 'shoryuken/extensions/active_job_adapter' if Shoryuken.active_job?
|
92
|
+
require File.expand_path('config/environment.rb')
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def require_workers(required)
|
97
|
+
return unless required
|
98
|
+
|
99
|
+
if File.directory?(required)
|
100
|
+
Dir[File.join(required, '**', '*.rb')].each(&method(:require))
|
101
|
+
else
|
102
|
+
require required
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require "active_job"
|
2
|
+
|
3
|
+
module Maitredee
|
4
|
+
class Publisher
|
5
|
+
class << self
|
6
|
+
def inherited(subclass)
|
7
|
+
subclass.const_set("PublisherJob", Class.new(PublisherJob))
|
8
|
+
subclass::PublisherJob.service_class = subclass
|
9
|
+
end
|
10
|
+
|
11
|
+
def call_later(*args)
|
12
|
+
self::PublisherJob.perform_later(*args)
|
13
|
+
end
|
14
|
+
|
15
|
+
def call(*args)
|
16
|
+
publisher = new(*args)
|
17
|
+
publisher.process
|
18
|
+
publisher.published_messages
|
19
|
+
end
|
20
|
+
|
21
|
+
def publish_defaults(topic_name: nil, event_name: nil, schema_name: nil)
|
22
|
+
@publish_defaults = {
|
23
|
+
topic_name: topic_name,
|
24
|
+
event_name: event_name,
|
25
|
+
schema_name: schema_name
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_publish_defaults
|
30
|
+
@publish_defaults
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def published_messages
|
35
|
+
@published_messages ||= []
|
36
|
+
end
|
37
|
+
|
38
|
+
def publish(topic_name: nil, event_name: nil, schema_name: nil, primary_key: nil, body:)
|
39
|
+
defaults = self.class.get_publish_defaults
|
40
|
+
published_messages << Maitredee.publish(
|
41
|
+
topic_name: topic_name || defaults[:topic_name],
|
42
|
+
event_name: event_name || defaults[:event_name],
|
43
|
+
schema_name: schema_name || defaults[:schema_name],
|
44
|
+
primary_key: primary_key,
|
45
|
+
body: body
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
class PublisherJob < ::ActiveJob::Base
|
50
|
+
class << self
|
51
|
+
attr_accessor :service_class
|
52
|
+
end
|
53
|
+
|
54
|
+
def perform(*args)
|
55
|
+
self.class.service_class.call(*args)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require "shoryuken"
|
2
|
+
|
3
|
+
module Maitredee
|
4
|
+
class Subscriber
|
5
|
+
EventConfig = Struct.new(
|
6
|
+
:action,
|
7
|
+
:event_name,
|
8
|
+
:minimum_schema,
|
9
|
+
keyword_init: true
|
10
|
+
)
|
11
|
+
|
12
|
+
class SubscriberProxy
|
13
|
+
attr_reader :subscriber
|
14
|
+
|
15
|
+
def initialize(subscriber)
|
16
|
+
@subscriber = subscriber
|
17
|
+
end
|
18
|
+
|
19
|
+
def event(event_name, to: nil, minimum_schema: nil)
|
20
|
+
if event_name.nil? && to.nil?
|
21
|
+
raise ArgumentError, "event_name and to: cannot both be nil"
|
22
|
+
end
|
23
|
+
|
24
|
+
event_config = EventConfig.new(
|
25
|
+
event_name: event_name.to_s,
|
26
|
+
action: (to || event_name).to_s,
|
27
|
+
minimum_schema: minimum_schema
|
28
|
+
)
|
29
|
+
|
30
|
+
subscriber.event_configs[event_config.event_name] = event_config
|
31
|
+
end
|
32
|
+
|
33
|
+
def default_event(to:, minimum_schema: nil)
|
34
|
+
subscriber.event_configs.default = EventConfig.new(
|
35
|
+
event_name: nil,
|
36
|
+
action: to.to_s,
|
37
|
+
minimum_schema: minimum_schema
|
38
|
+
)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class << self
|
43
|
+
attr_reader :topic_name
|
44
|
+
|
45
|
+
def subscribe_to(topic_name, queue_name: nil, queue_resource_name: nil, &block)
|
46
|
+
@topic_name = topic_name
|
47
|
+
@queue_name = queue_name if queue_name
|
48
|
+
@queue_resource_name = queue_resource_name if queue_resource_name
|
49
|
+
|
50
|
+
proxy = SubscriberProxy.new(self)
|
51
|
+
proxy.instance_eval(&block)
|
52
|
+
|
53
|
+
if event_configs.empty? && event_configs.default.nil?
|
54
|
+
raise Maitredee::NoRoutesError, "No events routed"
|
55
|
+
end
|
56
|
+
|
57
|
+
Maitredee.register_subscriber(self)
|
58
|
+
end
|
59
|
+
|
60
|
+
def event_configs
|
61
|
+
@event_configs ||= {}
|
62
|
+
end
|
63
|
+
|
64
|
+
def queue_name
|
65
|
+
@queue_name ||= name.chomp(Subscriber.name.demodulize).underscore.dasherize
|
66
|
+
end
|
67
|
+
|
68
|
+
def queue_resource_name
|
69
|
+
@queue_resource_name ||= Maitredee.queue_resource_name(topic_name, queue_name)
|
70
|
+
end
|
71
|
+
|
72
|
+
def process(message)
|
73
|
+
event_config = event_configs[message.event_name.to_s]
|
74
|
+
if event_config
|
75
|
+
new(message).send(event_config.action)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
attr_reader :message
|
81
|
+
|
82
|
+
def initialize(message)
|
83
|
+
@message = message
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
data/lib/maitredee.rb
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
require "json"
|
2
|
+
require "json_schemer"
|
3
|
+
require "set"
|
4
|
+
require "active_support/concern"
|
5
|
+
require "active_support/core_ext/string/inflections"
|
6
|
+
require "active_support/core_ext/object/json"
|
7
|
+
require "active_support/json"
|
8
|
+
require "pathname"
|
9
|
+
require "maitredee/publisher"
|
10
|
+
require "maitredee/subscriber"
|
11
|
+
require "maitredee/version"
|
12
|
+
require "maitredee/adapters/sns_sqs_adapter"
|
13
|
+
|
14
|
+
module Maitredee
|
15
|
+
class << self
|
16
|
+
attr_accessor :resource_name_suffix, :schema_path
|
17
|
+
attr_reader :client
|
18
|
+
attr_writer :app_name, :namespace
|
19
|
+
|
20
|
+
def publish(
|
21
|
+
topic_name:,
|
22
|
+
body:,
|
23
|
+
schema_name:,
|
24
|
+
event_name: nil,
|
25
|
+
primary_key: nil
|
26
|
+
)
|
27
|
+
raise ArgumentError, "topic_name, body or schema_name is nil" if topic_name.nil? || body.nil? || schema_name.nil?
|
28
|
+
body = body.as_json
|
29
|
+
validate!(body, schema_name)
|
30
|
+
|
31
|
+
message = PublisherMessage.new(
|
32
|
+
message_id: SecureRandom.uuid,
|
33
|
+
topic_resource_name: topic_resource_name(topic_name),
|
34
|
+
topic_name: topic_name.to_s,
|
35
|
+
body: body,
|
36
|
+
schema_name: schema_name&.to_s,
|
37
|
+
event_name: event_name&.to_s,
|
38
|
+
primary_key: primary_key&.to_s
|
39
|
+
)
|
40
|
+
|
41
|
+
client.publish(message)
|
42
|
+
|
43
|
+
message
|
44
|
+
end
|
45
|
+
|
46
|
+
def set_client(slug, *args)
|
47
|
+
raise "No client set for Maitredee" if slug.nil?
|
48
|
+
@client = "::Maitredee::Adapters::#{slug.to_s.camelize}Adapter".constantize.new(*args)
|
49
|
+
end
|
50
|
+
|
51
|
+
def client=(slug)
|
52
|
+
set_client(slug)
|
53
|
+
end
|
54
|
+
|
55
|
+
def topic_resource_name(topic_name)
|
56
|
+
[
|
57
|
+
namespace,
|
58
|
+
topic_name,
|
59
|
+
resource_name_suffix
|
60
|
+
].compact.join("--")
|
61
|
+
end
|
62
|
+
|
63
|
+
def queue_resource_name(topic_name, queue_name)
|
64
|
+
[
|
65
|
+
namespace,
|
66
|
+
topic_name,
|
67
|
+
app_name,
|
68
|
+
queue_name,
|
69
|
+
resource_name_suffix
|
70
|
+
].compact.join("--").tap do |val|
|
71
|
+
if val.length > 80
|
72
|
+
raise "Cannot have a queue name longer than 80 characters: #{name}"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def validate!(body, schema)
|
78
|
+
errors = schemas[schema].validate(body.as_json)
|
79
|
+
properties = errors.map do |error|
|
80
|
+
error["data_pointer"]
|
81
|
+
end.join(", ")
|
82
|
+
|
83
|
+
if errors.any?
|
84
|
+
raise ValidationError, "Invalid properties: #{properties}"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def schemas
|
89
|
+
@schemas ||= Hash.new do |hash, key|
|
90
|
+
path = Pathname.new(schema_path).join("#{key}.json")
|
91
|
+
hash[key] = JSONSchemer.schema(path)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def app_name
|
96
|
+
@app_name ||=
|
97
|
+
begin
|
98
|
+
rails_app_name =
|
99
|
+
if defined?(Rails)
|
100
|
+
Rails.application.class.parent_name.underscore.dasherize
|
101
|
+
end
|
102
|
+
ENV["MAITREDEE_APP_NAME"] ||
|
103
|
+
rails_app_name ||
|
104
|
+
raise("must set app_name for maitredee")
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def namespace
|
109
|
+
@namespace ||=
|
110
|
+
ENV["MAITREDEE_NAMESPACE"] || raise("must set namespace for maitredee")
|
111
|
+
end
|
112
|
+
|
113
|
+
def configure_broker
|
114
|
+
hash_array = Hash.new { |hash, key| hash[key] = [] }
|
115
|
+
topics_and_queues =
|
116
|
+
subscriber_registry.each_with_object(hash_array) do |subscriber, hash|
|
117
|
+
topic_arn = topic_resource_name(subscriber.topic_name)
|
118
|
+
hash[topic_arn] << queue_resource_name(subscriber.topic_name, subscriber.queue_name)
|
119
|
+
end
|
120
|
+
client.configure_broker(topics_and_queues)
|
121
|
+
end
|
122
|
+
|
123
|
+
def register_subscriber(klass)
|
124
|
+
client.add_worker(klass)
|
125
|
+
subscriber_registry.add(klass)
|
126
|
+
end
|
127
|
+
|
128
|
+
def subscriber_registry
|
129
|
+
@subscriber_registry ||= Set.new
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
Error = Class.new(StandardError)
|
134
|
+
ValidationError = Class.new(Error)
|
135
|
+
NoRoutesError = Class.new(Error)
|
136
|
+
|
137
|
+
PublisherMessage = Struct.new(
|
138
|
+
:message_id, :topic_resource_name, :topic_name, :body, :schema_name,
|
139
|
+
:event_name, :primary_key, keyword_init: true
|
140
|
+
)
|
141
|
+
|
142
|
+
SubscriberMessage = Struct.new(
|
143
|
+
:message_id, :broker_message_id, :topic_name, :event_name, :primary_key, :schema_name, :body,
|
144
|
+
:sent_at, :maitredee_version, :raw_message, :adapter_message, keyword_init: true
|
145
|
+
)
|
146
|
+
end
|
data/maitredee.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "maitredee/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "maitredee"
|
8
|
+
spec.version = Maitredee::VERSION
|
9
|
+
spec.authors = ["Plated Devs"]
|
10
|
+
spec.email = ["dev@plated.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Opinionated pub/sub framework}
|
13
|
+
#spec.description = %q{Opinionated pub/sub framework}
|
14
|
+
spec.homepage = "https://github.com/plated/maitredee"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_dependency "activejob"
|
27
|
+
spec.add_dependency "activesupport"
|
28
|
+
spec.add_dependency "aws-sdk-sns"
|
29
|
+
spec.add_dependency "aws-sdk-sqs"
|
30
|
+
spec.add_dependency "json_schemer", "~> 0.1.8"
|
31
|
+
spec.add_dependency "shoryuken", ">= 4.0"
|
32
|
+
spec.add_dependency "thor"
|
33
|
+
|
34
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
35
|
+
spec.add_development_dependency "dotenv"
|
36
|
+
spec.add_development_dependency "pry"
|
37
|
+
spec.add_development_dependency "pry-byebug"
|
38
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
39
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
40
|
+
spec.add_development_dependency "rspec-mocks", "~> 3.0"
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,262 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: maitredee
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.8.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Plated Devs
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-12-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activejob
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: aws-sdk-sns
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: aws-sdk-sqs
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: json_schemer
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.1.8
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.1.8
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: shoryuken
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '4.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '4.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: thor
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: bundler
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.17'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.17'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: dotenv
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: pry
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: pry-byebug
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rake
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '10.0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '10.0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: rspec
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '3.0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '3.0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: rspec-mocks
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '3.0'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '3.0'
|
209
|
+
description:
|
210
|
+
email:
|
211
|
+
- dev@plated.com
|
212
|
+
executables:
|
213
|
+
- maitredee
|
214
|
+
extensions: []
|
215
|
+
extra_rdoc_files: []
|
216
|
+
files:
|
217
|
+
- ".circleci/config.yml"
|
218
|
+
- ".gitignore"
|
219
|
+
- ".rspec"
|
220
|
+
- ".ruby-version"
|
221
|
+
- CODE_OF_CONDUCT.md
|
222
|
+
- Gemfile
|
223
|
+
- Gemfile.lock
|
224
|
+
- LICENSE.txt
|
225
|
+
- README.md
|
226
|
+
- Rakefile
|
227
|
+
- bin/console
|
228
|
+
- bin/setup
|
229
|
+
- exe/maitredee
|
230
|
+
- lib/maitredee.rb
|
231
|
+
- lib/maitredee/adapters/sns_sqs_adapter.rb
|
232
|
+
- lib/maitredee/adapters/test_adapter.rb
|
233
|
+
- lib/maitredee/cli/runner.rb
|
234
|
+
- lib/maitredee/publisher.rb
|
235
|
+
- lib/maitredee/subscriber.rb
|
236
|
+
- lib/maitredee/version.rb
|
237
|
+
- maitredee.gemspec
|
238
|
+
homepage: https://github.com/plated/maitredee
|
239
|
+
licenses:
|
240
|
+
- MIT
|
241
|
+
metadata: {}
|
242
|
+
post_install_message:
|
243
|
+
rdoc_options: []
|
244
|
+
require_paths:
|
245
|
+
- lib
|
246
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - ">="
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: '0'
|
251
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
252
|
+
requirements:
|
253
|
+
- - ">="
|
254
|
+
- !ruby/object:Gem::Version
|
255
|
+
version: '0'
|
256
|
+
requirements: []
|
257
|
+
rubyforge_project:
|
258
|
+
rubygems_version: 2.7.8
|
259
|
+
signing_key:
|
260
|
+
specification_version: 4
|
261
|
+
summary: Opinionated pub/sub framework
|
262
|
+
test_files: []
|