fluent-plugin-amqp2 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -0
- data/fluent-plugin-amqp2.gemspec +1 -1
- data/lib/fluent/plugin/out_amqp.rb +6 -3
- data/test/out_amqp.rb +2 -2
- metadata +4 -4
data/README.md
CHANGED
@@ -40,6 +40,9 @@ Or install it yourself as:
|
|
40
40
|
vhost /
|
41
41
|
exchange my_exchange
|
42
42
|
exchange_type topic
|
43
|
+
exchange_durable false # optionally set exchange durability - default is false.
|
44
|
+
payload_only false # optional - default is false. if true, only the payload will be sent. if false, data format is { "key" => tag, "timestamp" => time, "payload" => record }.
|
45
|
+
content_type application/octet-stream # optional - default is application/octet-stream. some amqp consumers will expect application/json.
|
43
46
|
</match>
|
44
47
|
```
|
45
48
|
|
data/fluent-plugin-amqp2.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = "fluent-plugin-amqp2"
|
7
|
-
gem.version = "0.0.
|
7
|
+
gem.version = "0.0.2"
|
8
8
|
gem.authors = ["Augusto Becciu", "Juan Manuel Barreneche"]
|
9
9
|
gem.email = ["devs@restorando.com"]
|
10
10
|
|
@@ -12,6 +12,9 @@ class AmqpOutput < Fluent::BufferedOutput
|
|
12
12
|
config_param :vhost, :string, default: "/"
|
13
13
|
config_param :exchange, :string, default: ""
|
14
14
|
config_param :exchange_type, :string, default: "topic"
|
15
|
+
config_param :exchange_durable, :bool, default: true
|
16
|
+
config_param :payload_only, :bool, default: false
|
17
|
+
config_param :content_type, :string, default: "application/octet-stream"
|
15
18
|
|
16
19
|
def initialize(*)
|
17
20
|
super
|
@@ -62,8 +65,8 @@ class AmqpOutput < Fluent::BufferedOutput
|
|
62
65
|
# 'chunk.open {|io| ... }' to get IO objects.
|
63
66
|
def write(chunk)
|
64
67
|
chunk.msgpack_each do |(tag, time, record)|
|
65
|
-
event = { "key" => tag, "timestamp" => time, "payload" => record }
|
66
|
-
get_or_create_exchange.publish Yajl.dump(event), routing_key: tag
|
68
|
+
event = @payload_only ? record : { "key" => tag, "timestamp" => time, "payload" => record }
|
69
|
+
get_or_create_exchange.publish Yajl.dump(event), routing_key: tag, content_type: @content_type
|
67
70
|
end
|
68
71
|
end
|
69
72
|
|
@@ -77,7 +80,7 @@ class AmqpOutput < Fluent::BufferedOutput
|
|
77
80
|
|
78
81
|
unless @amqp_channel && @amqp_channel.open?
|
79
82
|
@amqp_channel = @amqp_conn.create_channel
|
80
|
-
@amqp_exchange = Bunny::Exchange.new(@amqp_channel, @exchange_type.to_sym, @exchange_name, durable:
|
83
|
+
@amqp_exchange = Bunny::Exchange.new(@amqp_channel, @exchange_type.to_sym, @exchange_name, durable: @exchange_durable)
|
81
84
|
end
|
82
85
|
|
83
86
|
@amqp_exchange
|
data/test/out_amqp.rb
CHANGED
@@ -75,8 +75,8 @@ class AmqpOutputTest < Test::Unit::TestCase
|
|
75
75
|
|
76
76
|
ev1 = Yajl.dump({"key" => "test", "timestamp" => t, "payload" => {"a"=>1}})
|
77
77
|
ev2 = Yajl.dump({"key" => "test", "timestamp" => t, "payload" => {"a"=>2}})
|
78
|
-
amqp_exchange_mock.expects(:publish).with(ev1, { routing_key: "test" })
|
79
|
-
amqp_exchange_mock.expects(:publish).with(ev2, { routing_key: "test" })
|
78
|
+
amqp_exchange_mock.expects(:publish).with(ev1, { routing_key: "test", content_type: 'application/octet-stream' })
|
79
|
+
amqp_exchange_mock.expects(:publish).with(ev2, { routing_key: "test", content_type: 'application/octet-stream' })
|
80
80
|
|
81
81
|
d.run
|
82
82
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-amqp2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-09-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: fluentd
|
@@ -121,7 +121,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
121
121
|
version: '0'
|
122
122
|
segments:
|
123
123
|
- 0
|
124
|
-
hash:
|
124
|
+
hash: 599678964187772249
|
125
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
126
|
none: false
|
127
127
|
requirements:
|
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: '0'
|
131
131
|
segments:
|
132
132
|
- 0
|
133
|
-
hash:
|
133
|
+
hash: 599678964187772249
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project:
|
136
136
|
rubygems_version: 1.8.24
|