fluent-plugin-amqp 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MTIzYmM5YWJjYjNmY2IyZGRkOWM4NDg0NTUwOGE2ZTQ2OWFjYzdjNQ==
5
- data.tar.gz: !binary |-
6
- YjU4Y2E5ZDVmMDdlZmU5MmJjYjczNzgxNjFjOTc0ZGE0NGE2YzM5OA==
2
+ SHA1:
3
+ metadata.gz: ac0659509393a3cbe0f5a86a2925e8227e705f23
4
+ data.tar.gz: 86ab5e6981907aceec58b4a76abab2b1a483341d
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YmM5N2E2NDUyZTg5MzdkNDc0MmEwNTdiNGViYTUyZDQ1NDA1MTZiMGFkOWQ2
10
- ZGIzYWZlNTIyZDg5YTNlYTU2ZmUzNmMzMjk4OWE3ZTY5OTZiMDNhNDg4YWFm
11
- ODRiMTEzMmM3YWE0Yjg1ZWRjNmMwNjg5NzM1OWIxMDRlMmRhMDE=
12
- data.tar.gz: !binary |-
13
- OTdlMDgzMzM3MjAyYmYyYmQzNzVmZDgyMzgwNzc4MDdkYjkwYzViOTQ1YTdm
14
- Yzg2OTMwZGU4MzZmM2IwMWRhMzI4MTFhY2ZlMjFjYTZiMTZlYjg3ZjMzMWJk
15
- MTA5N2VmYWEwMzI3NGVjYTRiYjJhMTcwZTkwMTVlMGY5M2UyNTA=
6
+ metadata.gz: 3843d792b1904cffe3846ba20a73838774ab32e9a76254317d728aeb06277bea205fcd530b05d61ba9c620880ab8405d856fc2f15ea40b2a611361cc32025c17
7
+ data.tar.gz: da272abdad7b8ed575cf617c55cc5076e9d52edc2602385461dee42eedeb275ccde7a037b376b204b48af41eb1ba00db82cc97d3a61b149139770c33e71daea4
@@ -9,6 +9,10 @@ module Fluent
9
9
  define_method("router") { Engine }
10
10
  end
11
11
 
12
+ # Bunny connection handle
13
+ # - Allows mocking for test purposes
14
+ attr_accessor :connection
15
+
12
16
  config_param :tag, :string, :default => "hunter.amqp"
13
17
 
14
18
  config_param :host, :string, :default => nil
@@ -28,12 +32,18 @@ module Fluent
28
32
  config_param :tag_key, :bool, :default => false
29
33
  config_param :tag_header, :string, :default => nil
30
34
  config_param :time_header, :string, :default => nil
35
+ config_param :tls, :bool, :default => false
36
+ config_param :tls_cert, :string, :default => nil
37
+ config_param :tls_key, :string, :default => nil
38
+ config_param :tls_ca_certificates, :array, :default => nil
39
+ config_param :tls_verify_peer, :bool, :default => true
31
40
 
32
41
  def initialize
33
42
  require 'bunny'
34
43
  super
35
44
  end
36
45
 
46
+
37
47
  def configure(conf)
38
48
  conf['format'] ||= conf['payload_format'] # legacy
39
49
 
@@ -48,9 +58,8 @@ module Fluent
48
58
  unless @host && @queue
49
59
  raise ConfigError, "'host' and 'queue' must be all specified."
50
60
  end
51
- @bunny = Bunny.new(:host => @host, :port => @port, :vhost => @vhost,
52
- :pass => @pass, :user => @user, :ssl => @ssl,
53
- :verify_ssl => @verify_ssl, :heartbeat => @heartbeat)
61
+ check_tls_configuration
62
+
54
63
  end
55
64
 
56
65
  def start
@@ -59,14 +68,16 @@ module Fluent
59
68
  end
60
69
 
61
70
  def shutdown
62
- @bunny.stop
71
+ @connection.stop
63
72
  @thread.join
64
73
  super
65
74
  end
66
75
 
67
76
  def run
68
- @bunny.start
69
- @channel = @bunny.create_channel
77
+ # Create a new connection, unless its already been provided to us
78
+ @connection = Bunny.new get_connection_options unless @connection
79
+ @connection.start
80
+ @channel = @connection.create_channel
70
81
  q = @channel.queue(@queue, :passive => @passive, :durable => @durable,
71
82
  :exclusive => @exclusive, :auto_delete => @auto_delete)
72
83
  q.subscribe do |delivery, meta, msg|
@@ -110,6 +121,29 @@ module Fluent
110
121
  Time.new.to_i
111
122
  end
112
123
  end
124
+
125
+ def check_tls_configuration()
126
+ if @tls
127
+ unless @tls_key && @tls_cert
128
+ raise ConfigError, "'tls_key' and 'tls_cert' must be all specified if tls is enabled."
129
+ end
130
+ end
131
+ end
132
+
133
+ def get_connection_options()
134
+ opts = {
135
+ :host => @host, :port => @port, :vhost => @vhost,
136
+ :pass => @pass, :user => @user, :ssl => @ssl,
137
+ :verify_ssl => @verify_ssl, :heartbeat => @heartbeat,
138
+ :tls => @tls,
139
+ :tls_cert => @tls_cert,
140
+ :tls_key => @tls_key,
141
+ :verify_peer => @tls_verify_peer
142
+ }
143
+ opts[:tls_ca_certificates] = @tls_ca_certificates if @tls_ca_certificates
144
+ return opts
145
+ end
146
+
113
147
  end # class AMQPInput
114
148
 
115
149
  end # module Fluent
@@ -3,6 +3,8 @@ module Fluent
3
3
  class AMQPOutput < BufferedOutput
4
4
  Plugin.register_output("amqp", self)
5
5
 
6
+ attr_accessor :connection
7
+
6
8
  config_param :host, :string, :default => nil
7
9
  config_param :user, :string, :default => "guest"
8
10
  config_param :pass, :string, :default => "guest", :secret => true
@@ -21,6 +23,11 @@ module Fluent
21
23
  config_param :tag_key, :bool, :default => false
22
24
  config_param :tag_header, :string, :default => nil
23
25
  config_param :time_header, :string, :default => nil
26
+ config_param :tls, :bool, :default => false
27
+ config_param :tls_cert, :string, :default => nil
28
+ config_param :tls_key, :string, :default => nil
29
+ config_param :tls_ca_certificates, :array, :default => nil
30
+ config_param :tls_verify_peer, :bool, :default => true
24
31
 
25
32
  def initialize
26
33
  super
@@ -30,21 +37,21 @@ module Fluent
30
37
  def configure(conf)
31
38
  super
32
39
  @conf = conf
33
- unless @host && @exchange
34
- raise ConfigError, "'host' and 'exchange' must be all specified."
40
+ unless @host
41
+ raise ConfigError, "'host' must be specified."
35
42
  end
36
43
  unless @key || @tag_key
37
44
  raise ConfigError, "Either 'key' or 'tag_key' must be set."
38
45
  end
39
- @bunny = Bunny.new(:host => @host, :port => @port, :vhost => @vhost,
40
- :pass => @pass, :user => @user, :ssl => @ssl, :verify_ssl => @verify_ssl,
41
- :heartbeat => @heartbeat)
46
+ check_tls_configuration
42
47
  end
43
48
 
44
49
  def start
45
50
  super
46
- @bunny.start
47
- @channel = @bunny.create_channel
51
+ @connection = Bunny.new(get_connection_options) unless @connection
52
+
53
+ @connection.start
54
+ @channel = @connection.create_channel
48
55
  @exch = @channel.exchange(@exchange, :type => @exchange_type.intern,
49
56
  :passive => @passive, :durable => @durable,
50
57
  :auto_delete => @auto_delete)
@@ -52,7 +59,7 @@ module Fluent
52
59
 
53
60
  def shutdown
54
61
  super
55
- @bunny.stop
62
+ @connection.stop
56
63
  end
57
64
 
58
65
  def format(tag, time, record)
@@ -81,5 +88,29 @@ module Fluent
81
88
  end
82
89
  end
83
90
 
91
+
92
+ private
93
+ def check_tls_configuration()
94
+ if @tls
95
+ unless @tls_key && @tls_cert
96
+ raise ConfigError, "'tls_key' and 'tls_cert' must be all specified if tls is enabled."
97
+ end
98
+ end
99
+ end
100
+
101
+ def get_connection_options()
102
+ opts = {
103
+ :host => @host, :port => @port, :vhost => @vhost,
104
+ :pass => @pass, :user => @user, :ssl => @ssl,
105
+ :verify_ssl => @verify_ssl, :heartbeat => @heartbeat,
106
+ :tls => @tls,
107
+ :tls_cert => @tls_cert,
108
+ :tls_key => @tls_key,
109
+ :verify_peer => @tls_verify_peer
110
+ }
111
+ opts[:tls_ca_certificates] = @tls_ca_certificates if @tls_ca_certificates
112
+ return opts
113
+ end
114
+
84
115
  end
85
116
  end
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.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiromi Ishii
@@ -16,86 +16,114 @@ dependencies:
16
16
  name: fluentd
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ~>
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
21
  version: 0.12.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ~>
26
+ - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: 0.12.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: bunny
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ~>
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
35
  version: 2.2.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ~>
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: 2.2.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: shoulda
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ! '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ! '>='
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: rake
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ! '>='
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ! '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: minitest
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - <
75
+ - - "<"
76
76
  - !ruby/object:Gem::Version
77
77
  version: 5.0.0
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - <
82
+ - - "<"
83
83
  - !ruby/object:Gem::Version
84
84
  version: 5.0.0
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: test-unit
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - ! '>='
89
+ - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: 3.1.0
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - ! '>='
96
+ - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: 3.1.0
99
+ - !ruby/object:Gem::Dependency
100
+ name: bunny-mock
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '1.0'
106
+ type: :development
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '1.0'
113
+ - !ruby/object:Gem::Dependency
114
+ name: simplecov
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0.10'
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0.10'
99
127
  description: AMQP input/output plugin for fluentd
100
128
  email: sawanoboriyu@higanworks.com
101
129
  executables: []
@@ -116,17 +144,17 @@ require_paths:
116
144
  - lib
117
145
  required_ruby_version: !ruby/object:Gem::Requirement
118
146
  requirements:
119
- - - ! '>='
147
+ - - ">="
120
148
  - !ruby/object:Gem::Version
121
149
  version: '0'
122
150
  required_rubygems_version: !ruby/object:Gem::Requirement
123
151
  requirements:
124
- - - ! '>='
152
+ - - ">="
125
153
  - !ruby/object:Gem::Version
126
154
  version: '0'
127
155
  requirements: []
128
156
  rubyforge_project:
129
- rubygems_version: 2.4.8
157
+ rubygems_version: 2.5.1
130
158
  signing_key:
131
159
  specification_version: 4
132
160
  summary: AMQP input/output plugin or fluentd