fluent-plugin-nats 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-nats (0.0.1)
4
+ fluent-plugin-nats (0.0.2)
5
5
  fluentd (>= 0.10.7)
6
6
  nats (>= 0.4.22)
7
7
 
data/README.md CHANGED
@@ -19,3 +19,24 @@ Setup the NATS input:
19
19
  queue fluent.>
20
20
  </source>
21
21
  ~~~~~
22
+
23
+ # Suitable Queues
24
+
25
+ ## Components
26
+ * dea.>
27
+ * cloudcontrollers.>
28
+ * router.>
29
+ * cloudcontroller.>
30
+ * vcap.>
31
+ * droplet.>
32
+ * healthmanager.>
33
+
34
+ ## Services
35
+ * FilesystemaaS.>
36
+ * AtmosaaS.>
37
+ * MongoaaS.>
38
+ * MyaaS.>
39
+ * Neo4jaaS.>
40
+ * AuaaS.>
41
+ * RMQaaS.>
42
+ * RaaS.>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -11,7 +11,6 @@ module Fluent
11
11
  def initialize
12
12
  require "nats/client"
13
13
 
14
- #["TERM", "INT"].each { |sig| trap(sig) { NATS.stop } }
15
14
  NATS.on_error { |err| puts "Server Error: #{err}"; exit! }
16
15
  super
17
16
  end
@@ -28,7 +27,10 @@ module Fluent
28
27
  def start
29
28
  super
30
29
  $log.info "listening nats on #{@uri}/#{@queue}"
30
+ @main_thread = Thread.current
31
31
  @thread = Thread.new(&method(:run))
32
+ Thread.stop
33
+ @thread
32
34
  end
33
35
 
34
36
  def shutdown
@@ -38,11 +40,24 @@ module Fluent
38
40
  end
39
41
 
40
42
  def run
41
- NATS.start(:uri => @uri) {
42
- NATS.subscribe(@queue) do |msg, reply, sub|
43
- Engine.emit(sub, 0, msg)
44
- end
45
- }
43
+ if EM.reactor_running?
44
+ $log.info "Reactor already running"
45
+ NATS.connect(:uri => @uri) {
46
+ NATS.subscribe(@queue) do |msg, reply, sub|
47
+ Engine.emit(sub, 0, msg)
48
+ end
49
+ @main_thread.wakeup
50
+ }
51
+ else
52
+ $log.info "Reactor not running. Starting..."
53
+ NATS.start(:uri => @uri) {
54
+ NATS.subscribe(@queue) do |msg, reply, sub|
55
+ Engine.emit(sub, 0, msg)
56
+ end
57
+ $log.info "Reactor running #{EM.reactor_running?}"
58
+ @main_thread.wakeup
59
+ }
60
+ end
46
61
  end
47
62
  end
48
63
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-nats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-31 00:00:00.000000000 Z
12
+ date: 2012-09-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd