rapids_rivers 0.1.7 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +10 -10
- data/.travis.yml +5 -5
- data/CODE_OF_CONDUCT.md +74 -74
- data/Gemfile +4 -4
- data/LICENSE.txt +21 -21
- data/README.md +41 -41
- data/Rakefile +10 -10
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/lib/rapids_rivers/packet.rb +16 -2
- data/lib/rapids_rivers/rabbit_mq/rabbit_mq_rapids.rb +5 -0
- data/lib/rapids_rivers/rabbit_mq/rabbit_mq_river.rb +1 -1
- data/lib/rapids_rivers/river.rb +23 -11
- data/lib/rapids_rivers/version.rb +3 -3
- data/lib/rapids_rivers.rb +6 -6
- data/rapids_rivers.gemspec +38 -38
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b95372a2eb50dad8731f74de9130ca4f49bdccb
|
4
|
+
data.tar.gz: 853ea9e45ccfa8bc37c841f261514618e4f0550b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce9e878399fda319fca461812453c789f9fb74728fa52ec1706b742dcc200315e43cd2bab6eb661350203ef7ba5f4bc0d0a8ff9de0d4dcabe6cf134677f251af
|
7
|
+
data.tar.gz: 222be57275eba3de948feca6ad4aa8dad511c81dfd315194c24e243363a97f44490a9f4523ba7b14da72c27cb54e6458836e4ac863b7bdd3948833a39cd5205c
|
data/.gitignore
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
/.bundle/
|
2
|
-
/.yardoc
|
3
|
-
/Gemfile.lock
|
4
|
-
/_yardoc/
|
5
|
-
/coverage/
|
6
|
-
/doc/
|
7
|
-
/pkg/
|
8
|
-
/spec/reports/
|
9
|
-
/tmp/
|
10
|
-
*.gem
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
*.gem
|
data/.travis.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
rvm:
|
4
|
-
- 2.4.0
|
5
|
-
before_install: gem install bundler -v 1.14.3
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
rvm:
|
4
|
+
- 2.4.0
|
5
|
+
before_install: gem install bundler -v 1.14.3
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -1,74 +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 TODO: Write your email address. 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/
|
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 TODO: Write your email address. 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
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in rapids_rivers.gemspec
|
4
|
-
gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in rapids_rivers.gemspec
|
4
|
+
gemspec
|
data/LICENSE.txt
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2017 TODO: Write your name
|
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.
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 TODO: Write your name
|
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
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
-
# RapidsRivers
|
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/rapids_rivers`. 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 'rapids_rivers'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install rapids_rivers
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
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).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rapids_rivers. 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.
|
36
|
-
|
37
|
-
|
38
|
-
## License
|
39
|
-
|
40
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
1
|
+
# RapidsRivers
|
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/rapids_rivers`. 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 'rapids_rivers'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install rapids_rivers
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
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).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rapids_rivers. 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.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
|
-
|
4
|
-
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs << "test"
|
6
|
-
t.libs << "lib"
|
7
|
-
t.test_files = FileList['test/**/*_test.rb']
|
8
|
-
end
|
9
|
-
|
10
|
-
task :default => :test
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
3
|
+
|
4
|
+
Rake::TestTask.new(:test) do |t|
|
5
|
+
t.libs << "test"
|
6
|
+
t.libs << "lib"
|
7
|
+
t.test_files = FileList['test/**/*_test.rb']
|
8
|
+
end
|
9
|
+
|
10
|
+
task :default => :test
|
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "rapids_rivers"
|
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__)
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rapids_rivers"
|
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
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
set -euo pipefail
|
3
|
-
IFS=$'\n\t'
|
4
|
-
set -vx
|
5
|
-
|
6
|
-
bundle install
|
7
|
-
|
8
|
-
# Do any other automated setup that you need to do here
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
set -euo pipefail
|
3
|
+
IFS=$'\n\t'
|
4
|
+
set -vx
|
5
|
+
|
6
|
+
bundle install
|
7
|
+
|
8
|
+
# Do any other automated setup that you need to do here
|
data/lib/rapids_rivers/packet.rb
CHANGED
@@ -8,7 +8,7 @@ module RapidsRivers
|
|
8
8
|
VISIT_COUNT = 'system_read_count'
|
9
9
|
CONTRIBUTING_SERVICES = 'contributing_services'
|
10
10
|
|
11
|
-
attr_reader :contributing_services
|
11
|
+
attr_reader :contributing_services, :system_read_count
|
12
12
|
protected :contributing_services
|
13
13
|
|
14
14
|
def initialize(json_hash)
|
@@ -27,7 +27,7 @@ module RapidsRivers
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def to_json
|
30
|
-
|
30
|
+
update_hash
|
31
31
|
@json_hash.to_json
|
32
32
|
end
|
33
33
|
|
@@ -35,6 +35,20 @@ module RapidsRivers
|
|
35
35
|
"Packet (in JSON): #{self.to_json}"
|
36
36
|
end
|
37
37
|
|
38
|
+
def pretty_print
|
39
|
+
update_hash
|
40
|
+
JSON.pretty_generate @json_hash
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def update_hash
|
46
|
+
@used_keys.each do |key|
|
47
|
+
value = instance_variable_get("@#{key}".to_sym)
|
48
|
+
@json_hash[key] = value if value
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
38
52
|
end
|
39
53
|
|
40
54
|
end
|
@@ -1,5 +1,8 @@
|
|
1
1
|
require 'bunny'
|
2
2
|
|
3
|
+
# require 'pry'
|
4
|
+
# require 'pry-nav'
|
5
|
+
|
3
6
|
require_relative '../rapids_connection'
|
4
7
|
require_relative './rabbit_mq_river'
|
5
8
|
|
@@ -12,6 +15,8 @@ module RapidsRivers
|
|
12
15
|
RAPIDS = 'rapids'
|
13
16
|
|
14
17
|
def initialize(host_ip, port)
|
18
|
+
host_ip = host_ip || ENV['RABBITMQ_IP'] || throw("Need IP address for RabbitMQ")
|
19
|
+
port = port || ENV['RABBITMQ_PORT'] || 5672
|
15
20
|
@connection = Bunny.new(
|
16
21
|
:host => host_ip,
|
17
22
|
:port => port.to_i,
|
data/lib/rapids_rivers/river.rb
CHANGED
@@ -11,8 +11,8 @@ module RapidsRivers
|
|
11
11
|
attr_reader :rapids_connection, :listening_services
|
12
12
|
protected :rapids_connection, :listening_services
|
13
13
|
|
14
|
-
def initialize rapids_connection
|
15
|
-
@rapids_connection = rapids_connection
|
14
|
+
def initialize rapids_connection, read_count_limit = 9
|
15
|
+
@rapids_connection, @read_count_limit = rapids_connection, read_count_limit
|
16
16
|
@listening_services = []
|
17
17
|
@validations = []
|
18
18
|
rapids_connection.register(self);
|
@@ -20,10 +20,12 @@ module RapidsRivers
|
|
20
20
|
|
21
21
|
def message send_port, message
|
22
22
|
packet_problems = RapidsRivers::PacketProblems.new message
|
23
|
-
packet =
|
23
|
+
packet = validated_packet message, packet_problems
|
24
|
+
return if packet && packet.respond_to?(:system_read_count) && packet.system_read_count > @read_count_limit
|
24
25
|
@listening_services.each do |ls|
|
25
|
-
next ls.
|
26
|
-
|
26
|
+
next ls.packet(send_port, packet.clone_with_name(service_name(ls)), packet_problems) unless packet_problems.errors?
|
27
|
+
next unless ls.respond_to? :on_error
|
28
|
+
ls.on_error(send_port, packet_problems) if packet_problems.errors?
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
@@ -54,8 +56,8 @@ module RapidsRivers
|
|
54
56
|
def require_values(key_value_hashes)
|
55
57
|
key_value_hashes.each do |key, value|
|
56
58
|
@validations << lambda do |json_hash, packet, packet_problems|
|
57
|
-
validate_value key
|
58
|
-
create_accessors key
|
59
|
+
validate_value key, value, json_hash, packet_problems
|
60
|
+
create_accessors key, json_hash, packet
|
59
61
|
end
|
60
62
|
end
|
61
63
|
self
|
@@ -70,9 +72,15 @@ module RapidsRivers
|
|
70
72
|
self
|
71
73
|
end
|
72
74
|
|
75
|
+
protected
|
76
|
+
|
77
|
+
def service_name(service)
|
78
|
+
service.respond_to?(:service_name) ? service.service_name : '<unknown>'
|
79
|
+
end
|
80
|
+
|
73
81
|
private
|
74
82
|
|
75
|
-
def
|
83
|
+
def validated_packet message, packet_problems
|
76
84
|
begin
|
77
85
|
json_hash = JSON.parse(message)
|
78
86
|
packet = Packet.new json_hash
|
@@ -86,23 +94,27 @@ module RapidsRivers
|
|
86
94
|
end
|
87
95
|
|
88
96
|
def validate_required key, json_hash, packet_problems
|
89
|
-
|
90
|
-
return packet_problems.error "
|
97
|
+
key = key.to_s
|
98
|
+
return packet_problems.error "Missing required key '#{key}'" unless json_hash[key]
|
99
|
+
return packet_problems.error "Empty required key '#{key}'" unless value?(json_hash[key])
|
91
100
|
end
|
92
101
|
|
93
102
|
def validate_missing key, json_hash, packet_problems
|
103
|
+
key = key.to_s
|
94
104
|
return unless json_hash.key? key
|
95
105
|
return unless value?(json_hash[key])
|
96
|
-
packet_problems.error "Forbidden key #{key} detected"
|
106
|
+
packet_problems.error "Forbidden key '#{key}'' detected"
|
97
107
|
end
|
98
108
|
|
99
109
|
def validate_value key, value, json_hash, packet_problems
|
110
|
+
key = key.to_s
|
100
111
|
validate_required key, json_hash, packet_problems
|
101
112
|
return if json_hash[key] == value
|
102
113
|
packet_problems.error "Required value of key '#{key}' is '#{json_hash[key]}', not '#{value}'"
|
103
114
|
end
|
104
115
|
|
105
116
|
def create_accessors key, json_hash, packet
|
117
|
+
key = key.to_s
|
106
118
|
packet.used_key key
|
107
119
|
establish_variable key, json_hash[key], packet
|
108
120
|
define_getter key, packet
|
@@ -1,3 +1,3 @@
|
|
1
|
-
module RapidsRivers
|
2
|
-
VERSION = "0.
|
3
|
-
end
|
1
|
+
module RapidsRivers
|
2
|
+
VERSION = "0.2.9"
|
3
|
+
end
|
data/lib/rapids_rivers.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require "rapids_rivers/version"
|
2
|
-
require_relative "rapids_rivers/rabbit_mq/rabbit_mq_rapids"
|
3
|
-
|
4
|
-
module RapidsRivers
|
5
|
-
# Your code goes here...
|
6
|
-
end
|
1
|
+
require "rapids_rivers/version"
|
2
|
+
require_relative "rapids_rivers/rabbit_mq/rabbit_mq_rapids"
|
3
|
+
|
4
|
+
module RapidsRivers
|
5
|
+
# Your code goes here...
|
6
|
+
end
|
data/rapids_rivers.gemspec
CHANGED
@@ -1,38 +1,38 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'rapids_rivers/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "rapids_rivers"
|
8
|
-
spec.version = RapidsRivers::VERSION
|
9
|
-
spec.authors = ["Fred George"]
|
10
|
-
spec.email = ["fredgeorge@acm.org"]
|
11
|
-
|
12
|
-
spec.summary = %q{Provides a Rapids/Rivers framework for asynchronous MicroServices}
|
13
|
-
spec.description = %q{Provides a generic Rapids/Rivers framework, and a specific implementation
|
14
|
-
spec.homepage = "https://github.com/fredgeorge/rapids_rivers"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
-
# if spec.respond_to?(:metadata)
|
20
|
-
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
-
# else
|
22
|
-
# raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
-
# "public gem pushes."
|
24
|
-
# end
|
25
|
-
|
26
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
-
f.match(%r{^(test|spec|features)/})
|
28
|
-
end
|
29
|
-
spec.bindir = "exe"
|
30
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
-
spec.require_paths = ["lib"]
|
32
|
-
|
33
|
-
spec.add_development_dependency "bundler", "~> 1.14"
|
34
|
-
spec.add_development_dependency "rake", "~> 12.0"
|
35
|
-
spec.add_development_dependency "minitest", "~> 5.0"
|
36
|
-
spec.add_development_dependency "bunny", "~> 2.6"
|
37
|
-
spec.add_development_dependency "json", "~> 2.0"
|
38
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rapids_rivers/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rapids_rivers"
|
8
|
+
spec.version = RapidsRivers::VERSION
|
9
|
+
spec.authors = ["Fred George"]
|
10
|
+
spec.email = ["fredgeorge@acm.org"]
|
11
|
+
|
12
|
+
spec.summary = %q{Provides a Rapids/Rivers framework for asynchronous MicroServices}
|
13
|
+
spec.description = %q{Provides a generic Rapids/Rivers framework, and a specific implementation using RabbitMQ as the event bus.}
|
14
|
+
spec.homepage = "https://github.com/fredgeorge/rapids_rivers"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
# if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
# else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
# "public gem pushes."
|
24
|
+
# end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
34
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
35
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
36
|
+
spec.add_development_dependency "bunny", "~> 2.6"
|
37
|
+
spec.add_development_dependency "json", "~> 2.0"
|
38
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rapids_rivers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred George
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '2.0'
|
83
83
|
description: Provides a generic Rapids/Rivers framework, and a specific implementation
|
84
|
-
|
84
|
+
using RabbitMQ as the event bus.
|
85
85
|
email:
|
86
86
|
- fredgeorge@acm.org
|
87
87
|
executables: []
|
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
version: '0'
|
132
132
|
requirements: []
|
133
133
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.6.
|
134
|
+
rubygems_version: 2.6.11
|
135
135
|
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: Provides a Rapids/Rivers framework for asynchronous MicroServices
|