data_collector 0.36.0 → 0.39.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data_collector.gemspec +2 -0
- data/lib/data_collector/ext/base.rb +58 -0
- data/lib/data_collector/input/generic.rb +4 -1
- data/lib/data_collector/input/rpc.rb +1 -5
- data/lib/data_collector/output/generic.rb +4 -1
- data/lib/data_collector/output/rpc.rb +4 -2
- data/lib/data_collector/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05ef65e41068e348fb98f4006fa50917f0d1f36b321193388e506dca9d912a07
|
4
|
+
data.tar.gz: c711d472ea38bdcb999d1b2ef3701e6b6fc0f7933bac137aa65537decb0d3137
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6093dea6542e5bb7a01d8149aff449912e606e1d482b0f5cf1d54a6845776592cbf84ee4fda979797aec66ceca00022ecc8e51fbdaf01123c6721aa879961c9b
|
7
|
+
data.tar.gz: effdc6c09bf03c1d1683e3c95eda047078a9daedd4a31bf350b531b6760921e4a618f5693f07a26faa3ed77039db7ec2c1c622f03b951debfded1ca1fc16377d
|
data/data_collector.gemspec
CHANGED
@@ -51,6 +51,8 @@ Gem::Specification.new do |spec|
|
|
51
51
|
spec.add_runtime_dependency 'builder', '~> 3.2'
|
52
52
|
spec.add_runtime_dependency 'parse-cron', '~> 0.1'
|
53
53
|
spec.add_runtime_dependency 'linkeddata', '~> 3.3'
|
54
|
+
spec.add_runtime_dependency 'connection_pool', '~> 2.4'
|
55
|
+
|
54
56
|
|
55
57
|
spec.add_development_dependency 'bundler', '~> 2.3'
|
56
58
|
spec.add_development_dependency 'minitest', '~> 5.18'
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'connection_pool'
|
2
|
+
|
3
|
+
module BunnyBurrow
|
4
|
+
class Connection
|
5
|
+
include Singleton
|
6
|
+
attr_reader :connection, :started
|
7
|
+
attr_accessor :verify_peer, :connection_name, :rabbitmq_url
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
super
|
11
|
+
@started = false
|
12
|
+
end
|
13
|
+
def connection
|
14
|
+
@connection ||= Bunny.new(@rabbitmq_url, verify_peer: @verify_peer, connection_name: @connection_name)
|
15
|
+
unless @started
|
16
|
+
@connection.start
|
17
|
+
@started = true
|
18
|
+
end
|
19
|
+
|
20
|
+
@connection
|
21
|
+
end
|
22
|
+
|
23
|
+
def channel
|
24
|
+
@channel ||= ConnectionPool::Wrapper.new do
|
25
|
+
connection.create_channel
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class Base
|
31
|
+
attr_accessor(
|
32
|
+
:connection_name
|
33
|
+
)
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def connection
|
38
|
+
Connection.instance.connection_name = @connection_name
|
39
|
+
Connection.instance.verify_peer = @verify_peer
|
40
|
+
Connection.instance.rabbitmq_url = @rabbitmq_url
|
41
|
+
|
42
|
+
unless @connection
|
43
|
+
@connection = Connection.instance.connection
|
44
|
+
end
|
45
|
+
|
46
|
+
@connection
|
47
|
+
end
|
48
|
+
|
49
|
+
def channel
|
50
|
+
Connection.instance.connection_name = @connection_name
|
51
|
+
Connection.instance.verify_peer = @verify_peer
|
52
|
+
Connection.instance.rabbitmq_url = @rabbitmq_url
|
53
|
+
|
54
|
+
@channel ||= Connection.instance.channel
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
@@ -1,4 +1,7 @@
|
|
1
|
+
require 'bunny_burrow'
|
2
|
+
require_relative '../ext/base'
|
1
3
|
require 'listen'
|
4
|
+
require 'active_support/core_ext/hash'
|
2
5
|
|
3
6
|
module DataCollector
|
4
7
|
class Input
|
@@ -56,7 +59,7 @@ module DataCollector
|
|
56
59
|
|
57
60
|
private
|
58
61
|
|
59
|
-
def create_listener
|
62
|
+
def create_listener(log = false)
|
60
63
|
raise DataCollector::Error, 'Please implement a listener'
|
61
64
|
end
|
62
65
|
|
@@ -1,9 +1,4 @@
|
|
1
1
|
require_relative 'generic'
|
2
|
-
require 'bunny_burrow'
|
3
|
-
require 'active_support/core_ext/hash'
|
4
|
-
require 'ostruct'
|
5
|
-
require 'securerandom'
|
6
|
-
require 'thread'
|
7
2
|
|
8
3
|
module DataCollector
|
9
4
|
class Input
|
@@ -64,6 +59,7 @@ module DataCollector
|
|
64
59
|
server.rabbitmq_url = @bunny_uri.to_s
|
65
60
|
server.rabbitmq_exchange = @bunny_channel
|
66
61
|
|
62
|
+
server.connection_name = @name
|
67
63
|
server.logger = DataCollector::Core.logger if log
|
68
64
|
end
|
69
65
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'bunny_burrow'
|
2
|
+
require_relative '../ext/base'
|
2
3
|
require 'json'
|
4
|
+
require 'active_support/core_ext/hash'
|
3
5
|
|
4
6
|
module DataCollector
|
5
7
|
class Output
|
@@ -9,6 +11,7 @@ module DataCollector
|
|
9
11
|
@options = options
|
10
12
|
@running = false
|
11
13
|
|
14
|
+
@name = options[:name] || "output-#{Time.now.to_i}-#{rand(10000)}"
|
12
15
|
create_producer
|
13
16
|
end
|
14
17
|
|
@@ -29,7 +32,7 @@ module DataCollector
|
|
29
32
|
end
|
30
33
|
|
31
34
|
private
|
32
|
-
def create_producer
|
35
|
+
def create_producer(log = false)
|
33
36
|
raise DataCollector::Error, 'Please implement a producer'
|
34
37
|
end
|
35
38
|
|
@@ -20,12 +20,14 @@ module DataCollector
|
|
20
20
|
end
|
21
21
|
|
22
22
|
private
|
23
|
-
def create_producer
|
23
|
+
def create_producer(log = false)
|
24
24
|
@producer ||= BunnyBurrow::Client.new do |client|
|
25
25
|
parse_uri
|
26
26
|
client.rabbitmq_url = @bunny_uri.to_s
|
27
27
|
client.rabbitmq_exchange = @bunny_channel
|
28
|
-
client.
|
28
|
+
client.connection_name = @name
|
29
|
+
|
30
|
+
client.logger = DataCollector::Core.logger if log
|
29
31
|
@running = true
|
30
32
|
end
|
31
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_collector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.39.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mehmet Celik
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -220,6 +220,20 @@ dependencies:
|
|
220
220
|
- - "~>"
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '3.3'
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: connection_pool
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - "~>"
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '2.4'
|
230
|
+
type: :runtime
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - "~>"
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '2.4'
|
223
237
|
- !ruby/object:Gem::Dependency
|
224
238
|
name: bundler
|
225
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -296,6 +310,7 @@ files:
|
|
296
310
|
- lib/data_collector.rb
|
297
311
|
- lib/data_collector/config_file.rb
|
298
312
|
- lib/data_collector/core.rb
|
313
|
+
- lib/data_collector/ext/base.rb
|
299
314
|
- lib/data_collector/ext/xml_utility_node.rb
|
300
315
|
- lib/data_collector/input.rb
|
301
316
|
- lib/data_collector/input/dir.rb
|