rflow-components-amqp 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.yardopts +1 -0
- data/Rakefile +2 -6
- data/lib/rflow/components/amqp.rb +5 -0
- data/lib/rflow/components/amqp/extensions.rb +3 -0
- data/lib/rflow/components/amqp/subscriber.rb +70 -1
- data/lib/rflow/components/amqp/version.rb +2 -1
- data/rflow-components-amqp.gemspec +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 414abeef9741db55a09645e77f089bf0b6dc03ce
|
4
|
+
data.tar.gz: d089580659a2a37706f19e76ae819b916775692d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 148d61bc35cdd305f879ed0ae0b1a3d80196eed52e29122bfa9c787c1d8a5d43474789bdcf519581fe97a11ca7c22a260838c8bb3fd73e6036905b3076c2076b
|
7
|
+
data.tar.gz: 1c06feb76f1141a22d434dfbeaaee9ac3a7664cdcd56043a0eba7cd627a48726687c1237c19f4c1f75d660d338fa81e342d1c12507c6d17ef9c0ee931fd160a1
|
data/.gitignore
CHANGED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--output ./doc --main README.md --files schema/*.avsc lib/**/*.rb - README.md LICENSE
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
require 'rspec/core/rake_task'
|
3
|
-
require '
|
3
|
+
require 'yard'
|
4
4
|
Bundler::GemHelper.install_tasks
|
5
5
|
|
6
6
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
@@ -8,8 +8,4 @@ RSpec::Core::RakeTask.new(:spec) do |t|
|
|
8
8
|
t.rspec_opts = '--tty --color'
|
9
9
|
end
|
10
10
|
|
11
|
-
Rake::
|
12
|
-
rd.main = "README.md"
|
13
|
-
rd.rdoc_files.include("README.md", "lib/**/*.rb")
|
14
|
-
rd.rdoc_dir = File.join('doc', 'html')
|
15
|
-
end
|
11
|
+
YARD::Rake::YardocTask.new
|
@@ -1,12 +1,17 @@
|
|
1
1
|
require 'rflow/components/amqp/extensions'
|
2
2
|
require 'rflow/components/amqp/subscriber'
|
3
3
|
|
4
|
+
# RFlow classes.
|
4
5
|
class RFlow
|
6
|
+
# RFlow component classes.
|
5
7
|
module Components
|
8
|
+
# AMQP RFlow component classes.
|
6
9
|
module AMQP
|
7
10
|
# Load the schemas
|
11
|
+
# @!visibility private
|
8
12
|
SCHEMA_DIRECTORY = ::File.expand_path(::File.join(::File.dirname(__FILE__), '..', '..', '..', 'schema'))
|
9
13
|
|
14
|
+
# @!visibility private
|
10
15
|
SCHEMA_FILES = {
|
11
16
|
'amqp_message.avsc' => 'RFlow::Message::Data::AMQP::Message',
|
12
17
|
}
|
@@ -1,8 +1,11 @@
|
|
1
1
|
class RFlow
|
2
2
|
module Components
|
3
3
|
module AMQP
|
4
|
+
# @!visibility private
|
4
5
|
module Extensions
|
6
|
+
# @!visibility private
|
5
7
|
module AMQPMessageExtension
|
8
|
+
# @!visibility private
|
6
9
|
def self.extended(base_data)
|
7
10
|
base_data.data_object ||= {'header' => {}, 'payload' => ''}
|
8
11
|
end
|
@@ -4,18 +4,82 @@ require 'rflow'
|
|
4
4
|
require 'time'
|
5
5
|
|
6
6
|
class RFlow
|
7
|
+
# @!parse
|
8
|
+
# # Fake classes in this tree to document the actual message types.
|
9
|
+
# class Message
|
10
|
+
# # Fake classes in this tree to document the actual message types.
|
11
|
+
# class Data
|
12
|
+
# # AMQP messages.
|
13
|
+
# module AMQP
|
14
|
+
# # RFlow format defined for AMQP messages which can be emitted by
|
15
|
+
# # {RFlow::Components::AMQP::Subscriber}. Of course the real class
|
16
|
+
# # is {RFlow::Message} with type +RFlow::Message::Data::AMQP::Message+.
|
17
|
+
# class Message
|
18
|
+
# # @!attribute header
|
19
|
+
# # The header of the message.
|
20
|
+
# # @return [String]
|
21
|
+
#
|
22
|
+
# # @!attribute payload
|
23
|
+
# # The payload of the message.
|
24
|
+
# # @return [String]
|
25
|
+
#
|
26
|
+
# # Just here to force Yard to create documentation.
|
27
|
+
# # @!visibility private
|
28
|
+
# def initialize; end
|
29
|
+
# end
|
30
|
+
# end
|
31
|
+
# end
|
32
|
+
# end
|
33
|
+
|
34
|
+
# Components.
|
7
35
|
module Components
|
8
36
|
module AMQP
|
37
|
+
# Component that subscribes to an AMQP topic and issues +RFlow::Message+s
|
38
|
+
# of type {RFlow::Message::Data::AMQP::Message} and +RFlow::Message::Data::Raw+
|
39
|
+
# when it receives messages on the AMQP topic.
|
40
|
+
#
|
9
41
|
# By default will use an exclusive, non-durable, auto-deleting,
|
10
42
|
# randomly named queue for subscribing to topic messages with an
|
11
|
-
# empty-string pattern
|
43
|
+
# empty-string pattern.
|
44
|
+
#
|
45
|
+
# Accepts config parameters:
|
46
|
+
# - +server+ - server address
|
47
|
+
# - +port+ - server port
|
48
|
+
# - +username+ - server username
|
49
|
+
# - +password+ - server password
|
50
|
+
# - +vhost+ - vhost
|
51
|
+
# - +reconnect_interval+ - how long to wait when disconnected before reconnecting
|
52
|
+
# - +queue_name+ - AMQP topic name to monitor
|
53
|
+
# - +queue_passive+ - +queue_passive+ parameter to AMQP
|
54
|
+
# - +queue_durable+ - +queue_durable+ parameter to AMQP
|
55
|
+
# - +queue_exclusive+ - +queue_exclusive+ parameter to AMQP
|
56
|
+
# - +queue_auto_delete+ - +queue_auto_delete+ parameter to AMQP
|
57
|
+
# - +binding_pattern+ - AMQP routing key
|
12
58
|
class Subscriber < RFlow::Component
|
59
|
+
# @!attribute [r] amqp_port
|
60
|
+
# Outputs +RFlow::Message+s of type {RFlow::Message::Data::AMQP::Message}
|
61
|
+
# when receiving an AMQP message.
|
62
|
+
#
|
63
|
+
# @return [RFlow::Component::OutputPort]
|
13
64
|
output_port :amqp_port
|
65
|
+
|
66
|
+
# @!attribute [r] raw_port
|
67
|
+
# Outputs +RFlow::Message+s of type +RFlow::Message::Data::Raw+
|
68
|
+
# when receiving an AMQP message. Messages contain just the bytes.
|
69
|
+
#
|
70
|
+
# @return [RFlow::Component::OutputPort]
|
14
71
|
output_port :raw_port
|
72
|
+
|
73
|
+
# @!attribute [r] log_port
|
74
|
+
# Outputs +RFlow::Message+s of type {RFlow::Message:Data::Log} if there
|
75
|
+
# are problems with the AMQP subscriber..
|
76
|
+
# @return [RFlow::Component::OutputPort]
|
15
77
|
output_port :log_port
|
16
78
|
|
79
|
+
# @!visibility private
|
17
80
|
attr_accessor :config, :queue_config
|
18
81
|
|
82
|
+
# Default config.
|
19
83
|
DEFAULT_CONFIG = {
|
20
84
|
'server' => '127.0.0.1',
|
21
85
|
'port' => 5672,
|
@@ -33,6 +97,8 @@ class RFlow
|
|
33
97
|
'binding_pattern' => '',
|
34
98
|
}
|
35
99
|
|
100
|
+
# RFlow-called method at startup.
|
101
|
+
# @return [void]
|
36
102
|
def configure!(config)
|
37
103
|
@config = DEFAULT_CONFIG.merge config
|
38
104
|
@config['port'] = @config['port'].to_i
|
@@ -51,6 +117,8 @@ class RFlow
|
|
51
117
|
end
|
52
118
|
end
|
53
119
|
|
120
|
+
# RFlow-called method at startup.
|
121
|
+
# @return [void]
|
54
122
|
def run!
|
55
123
|
::AMQP.connect(:host => @config['server'], :port => @config['port'], :vhost => @config['vhost'],
|
56
124
|
:username => @config['username'], :password => @config['password']) do |conn|
|
@@ -100,6 +168,7 @@ class RFlow
|
|
100
168
|
end
|
101
169
|
end
|
102
170
|
|
171
|
+
# @!visibility private
|
103
172
|
def to_boolean(string)
|
104
173
|
case string
|
105
174
|
when /^true$/i, '1', true; true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rflow-components-amqp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael L. Artz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rflow
|
@@ -100,6 +100,20 @@ dependencies:
|
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '10.3'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: yard
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0.9'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0.9'
|
103
117
|
description: AMQP publisher and subscriber component for the RFlow FBP framework. Also
|
104
118
|
includes the necessary AMQP::Message message type
|
105
119
|
email:
|
@@ -113,6 +127,7 @@ files:
|
|
113
127
|
- ".ruby-gemset"
|
114
128
|
- ".ruby-version"
|
115
129
|
- ".travis.yml"
|
130
|
+
- ".yardopts"
|
116
131
|
- Gemfile
|
117
132
|
- LICENSE
|
118
133
|
- README.md
|