fluent-plugin-amqp 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/fluent/plugin/out_amqp.rb +14 -3
  2. metadata +3 -3
@@ -11,6 +11,11 @@ module Fluent
11
11
 
12
12
  attr_accessor :connection
13
13
 
14
+ #Attribute readers to support testing
15
+ attr_reader :exch
16
+ attr_reader :channel
17
+
18
+
14
19
  config_param :host, :string, :default => nil
15
20
  config_param :hosts, :array, :default => nil
16
21
  config_param :user, :string, :default => "guest"
@@ -83,9 +88,15 @@ module Fluent
83
88
 
84
89
  def write(chunk)
85
90
  chunk.msgpack_each do |(tag, time, data)|
86
- data = JSON.dump( data ) unless data.is_a?( String )
87
- log.debug "Sending message #{data}, :key => #{routing_key( tag)} :headers => #{headers(tag,time)}"
88
- @exch.publish(data, :key => routing_key( tag ), :persistent => @persistent, :headers => headers( tag, time ))
91
+ begin
92
+ data = JSON.dump( data ) unless data.is_a?( String )
93
+ log.debug "Sending message #{data}, :key => #{routing_key( tag)} :headers => #{headers(tag,time)}"
94
+ @exch.publish(data, :key => routing_key( tag ), :persistent => @persistent, :headers => headers( tag, time ))
95
+ rescue JSON::GeneratorError => e
96
+ log.error "Failure converting data object to json string: #{e.message}"
97
+ # Debug only - otherwise we may pollute the fluent logs with unparseable events and loop
98
+ log.debug "JSON.dump failure converting [#{data}]"
99
+ end
89
100
  end
90
101
  end
91
102
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-amqp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-08-30 00:00:00.000000000 Z
15
+ date: 2016-09-07 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: fluentd
@@ -183,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
183
183
  version: '0'
184
184
  segments:
185
185
  - 0
186
- hash: 803931007263288493
186
+ hash: 337161649261298881
187
187
  required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  none: false
189
189
  requirements: