data_collector 0.36.0 → 0.38.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 649b618a7676b2153451b2bc3053726dd332ccc95a58ce0fe7115f4c9cc5a7eb
4
- data.tar.gz: 625ca0e9da4e6b986d7ead973c80fc04a87a5539f0f7263efc672ee0f3ef7eb1
3
+ metadata.gz: 7c584cb29547a8e6e2caf026d8860228366e2cae387ac4111c125e5450a90586
4
+ data.tar.gz: ea87c6fec5817023b653472f6566bf48e951755e16b8e5ab08378c4600ca01fe
5
5
  SHA512:
6
- metadata.gz: 2372b50b9fc9e6f5a17575c1755e169f0ddbaef44ed96847d8f5c87b28a3e30e46276cf47f6e506fe843a2293190b54fd556978ea175f937693abd4f83a637dd
7
- data.tar.gz: 7a417a9ee3a70140a3601d20613159222f6c2d6d0d7feaa99c447c7e31306f14c6f08c50543cb8fda85315b5fe62abde202e2b3bda51ac421f6a517f7b6be740
6
+ metadata.gz: c6b8fbe6975c800cd2ca179d6cc97555aa6b2cfa279d223f9cb52c03fa48186e336f6129701b820630eba912901c7d4b2a60f58678f282742cba36f4b46e0b3c
7
+ data.tar.gz: f08929aea4bb836e55a8ac0203cf14048ccfe1c60d1ed7af871625938877c0b2f38619cf2923da48bac9e002fa9dd37967639713390f0bc4c011dcd54f7eb50d
@@ -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, :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: @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
+ :name
33
+ )
34
+
35
+ private
36
+
37
+ def connection
38
+ Connection.instance.name = @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.name = @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
@@ -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
@@ -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.logger = DataCollector::Core.logger
28
+ #client.connection_name = @name
29
+
30
+ client.logger = DataCollector::Core.logger if log
29
31
  @running = true
30
32
  end
31
33
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module DataCollector
3
- VERSION = "0.36.0"
3
+ VERSION = "0.38.0"
4
4
  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.36.0
4
+ version: 0.38.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-21 00:00:00.000000000 Z
11
+ date: 2023-11-24 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