reacter 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,14 +22,11 @@ class Reacter
22
22
 
23
23
  def connect(args={})
24
24
  @addr = @config.get(:address, '0.0.0.0')
25
- @port = @config.get(:port, 54546)
25
+ @port = @config.get(:port, 54546).to_i
26
26
  @buffer = []
27
27
 
28
- if @config.get(:write)
29
- writer_addr = @config.get!('write.address')
30
- writer_port = @config.get!('write.port').to_i
31
-
32
- @writer = TCPSocket.new(writer_addr, writer_port)
28
+ if args.get(:mode) == 'write'
29
+ @writer = TCPSocket.new(@addr, @port)
33
30
  end
34
31
  end
35
32
 
@@ -56,12 +53,10 @@ class Reacter
56
53
  end
57
54
 
58
55
  def poll(&block)
59
- if @addr and @port
60
- @server = EM.start_server(@addr, @port, SocketHandler, proc{|data|
61
- messages = Message.parse(data.chomp)
62
- block.call(messages) unless messages.empty?
63
- })
64
- end
56
+ @server = EM.start_server(@addr, @port, SocketHandler, proc{|data|
57
+ messages = Message.parse(data.chomp)
58
+ block.call(messages) unless messages.empty?
59
+ })
65
60
  end
66
61
 
67
62
  def disconnect()
@@ -17,7 +17,9 @@ class Reacter
17
17
  @config.each do |c|
18
18
  if c['type']
19
19
  adapter = Adapter.create(c['type'], c)
20
- adapter.connect()
20
+ adapter.connect({
21
+ :mode => 'write'
22
+ })
21
23
  @_adapters << adapter
22
24
  Util.info("Relaying messages via #{c['type']} adapter")
23
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reacter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-03-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
16
- requirement: &21855120 !ruby/object:Gem::Requirement
16
+ requirement: &15369380 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *21855120
24
+ version_requirements: *15369380
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: em-http-server
27
- requirement: &21965600 !ruby/object:Gem::Requirement
27
+ requirement: &15467940 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *21965600
35
+ version_requirements: *15467940
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: deep_merge
38
- requirement: &21965080 !ruby/object:Gem::Requirement
38
+ requirement: &15467440 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *21965080
46
+ version_requirements: *15467440
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: hashlib
49
- requirement: &21964560 !ruby/object:Gem::Requirement
49
+ requirement: &15466960 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *21964560
57
+ version_requirements: *15466960
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: hiredis
60
- requirement: &21963960 !ruby/object:Gem::Requirement
60
+ requirement: &15466400 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *21963960
68
+ version_requirements: *15466400
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: multi_json
71
- requirement: &21963120 !ruby/object:Gem::Requirement
71
+ requirement: &15465480 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *21963120
79
+ version_requirements: *15465480
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: oj
82
- requirement: &21962540 !ruby/object:Gem::Requirement
82
+ requirement: &15464800 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *21962540
90
+ version_requirements: *15464800
91
91
  description: A utility for consuming, transforming, and routing monitoring data from
92
92
  various sources
93
93
  email: ghetzel@outbrain.com