logstash-output-rabbitmq 4.0.7-java → 4.0.8-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1865cf666ef2f3cb3ad389fa70283db7bbe488a0
4
- data.tar.gz: 18d9c2981691d76476326ab515938cdfe1553251
3
+ metadata.gz: dbde233852ddfa02201c3fe3e2bc05326624ef90
4
+ data.tar.gz: 2e0c0a8f71af46d29f42121155f4c8bc05907d14
5
5
  SHA512:
6
- metadata.gz: 0cc31b65bebd56a4aa01e47d4345a882543b67b4a5d096e6bc0fde137c65320d7c246df77716bf0fcd61c4b09aa4f91a94514859b264bf6d243498c6f3df7980
7
- data.tar.gz: 06d8d367ed0c3895dec7b0fee73db568d2188cb0a465c6e37dbb5c8cf7c477922e2c943e9dd5057c61669d7d0789dec233e2695e6b6d4c32a4f368e85a04ab3c
6
+ metadata.gz: 804b03b245fa79881a8fc914df74c1207eee2e2a3cda923f0ff5d68db4e4e0e41804cee786576f7e6649bb67a401adf62f36713c7a2a392c61ebc1d94cd0a55b
7
+ data.tar.gz: 05b45722189c028e8afcf8103540e368956598a583a269d49e648d85ef93b6a9773fdecfcb18a789cf5500dd599817ee1f9df1bac69f5069caa067ef59eb9fc0
data/Gemfile CHANGED
@@ -1,4 +1,11 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in logstash-mass_effect.gemspec
4
3
  gemspec
4
+
5
+ logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
6
+ use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
7
+
8
+ if Dir.exist?(logstash_path) && use_logstash_source
9
+ gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
10
+ gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
11
+ end
@@ -0,0 +1,279 @@
1
+ :plugin: rabbitmq
2
+ :type: output
3
+
4
+ ///////////////////////////////////////////
5
+ START - GENERATED VARIABLES, DO NOT EDIT!
6
+ ///////////////////////////////////////////
7
+ :version: %VERSION%
8
+ :release_date: %RELEASE_DATE%
9
+ :changelog_url: %CHANGELOG_URL%
10
+ :include_path: ../../../../logstash/docs/include
11
+ ///////////////////////////////////////////
12
+ END - GENERATED VARIABLES, DO NOT EDIT!
13
+ ///////////////////////////////////////////
14
+
15
+ [id="plugins-{type}-{plugin}"]
16
+
17
+ === Rabbitmq output plugin
18
+
19
+ include::{include_path}/plugin_header.asciidoc[]
20
+
21
+ ==== Description
22
+
23
+ Push events to a RabbitMQ exchange. Requires RabbitMQ 2.x
24
+ or later version (3.x is recommended).
25
+
26
+ Relevant links:
27
+
28
+ * http://www.rabbitmq.com/[RabbitMQ]
29
+ * http://rubymarchhare.info[March Hare]
30
+
31
+ [id="plugins-{type}s-{plugin}-options"]
32
+ ==== Rabbitmq Output Configuration Options
33
+
34
+ This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
35
+
36
+ [cols="<,<,<",options="header",]
37
+ |=======================================================================
38
+ |Setting |Input type|Required
39
+ | <<plugins-{type}s-{plugin}-arguments>> |<<array,array>>|No
40
+ | <<plugins-{type}s-{plugin}-automatic_recovery>> |<<boolean,boolean>>|No
41
+ | <<plugins-{type}s-{plugin}-connect_retry_interval>> |<<number,number>>|No
42
+ | <<plugins-{type}s-{plugin}-connection_timeout>> |<<number,number>>|No
43
+ | <<plugins-{type}s-{plugin}-durable>> |<<boolean,boolean>>|No
44
+ | <<plugins-{type}s-{plugin}-exchange>> |<<string,string>>|Yes
45
+ | <<plugins-{type}s-{plugin}-exchange_type>> |<<string,string>>, one of `["fanout", "direct", "topic", "x-consistent-hash", "x-modulus-hash"]`|Yes
46
+ | <<plugins-{type}s-{plugin}-heartbeat>> |<<number,number>>|No
47
+ | <<plugins-{type}s-{plugin}-host>> |<<string,string>>|Yes
48
+ | <<plugins-{type}s-{plugin}-key>> |<<string,string>>|No
49
+ | <<plugins-{type}s-{plugin}-passive>> |<<boolean,boolean>>|No
50
+ | <<plugins-{type}s-{plugin}-password>> |<<password,password>>|No
51
+ | <<plugins-{type}s-{plugin}-persistent>> |<<boolean,boolean>>|No
52
+ | <<plugins-{type}s-{plugin}-port>> |<<number,number>>|No
53
+ | <<plugins-{type}s-{plugin}-ssl>> |<<boolean,boolean>>|No
54
+ | <<plugins-{type}s-{plugin}-ssl_certificate_password>> |<<string,string>>|No
55
+ | <<plugins-{type}s-{plugin}-ssl_certificate_path>> |a valid filesystem path|No
56
+ | <<plugins-{type}s-{plugin}-ssl_version>> |<<string,string>>|No
57
+ | <<plugins-{type}s-{plugin}-user>> |<<string,string>>|No
58
+ | <<plugins-{type}s-{plugin}-vhost>> |<<string,string>>|No
59
+ |=======================================================================
60
+
61
+ Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
62
+ output plugins.
63
+
64
+ &nbsp;
65
+
66
+ [id="plugins-{type}s-{plugin}-arguments"]
67
+ ===== `arguments`
68
+
69
+ * Value type is <<array,array>>
70
+ * Default value is `{}`
71
+
72
+ Extra queue arguments as an array.
73
+ To make a RabbitMQ queue mirrored, use: `{"x-ha-policy" => "all"}`
74
+
75
+ [id="plugins-{type}s-{plugin}-automatic_recovery"]
76
+ ===== `automatic_recovery`
77
+
78
+ * Value type is <<boolean,boolean>>
79
+ * Default value is `true`
80
+
81
+ Set this to automatically recover from a broken connection. You almost certainly don't want to override this!!!
82
+
83
+ [id="plugins-{type}s-{plugin}-connect_retry_interval"]
84
+ ===== `connect_retry_interval`
85
+
86
+ * Value type is <<number,number>>
87
+ * Default value is `1`
88
+
89
+ Time in seconds to wait before retrying a connection
90
+
91
+ [id="plugins-{type}s-{plugin}-connection_timeout"]
92
+ ===== `connection_timeout`
93
+
94
+ * Value type is <<number,number>>
95
+ * There is no default value for this setting.
96
+
97
+ The default connection timeout in milliseconds. If not specified the timeout is infinite.
98
+
99
+ [id="plugins-{type}s-{plugin}-debug"]
100
+ ===== `debug` (DEPRECATED)
101
+
102
+ * DEPRECATED WARNING: This configuration item is deprecated and may not be available in future versions.
103
+ * Value type is <<boolean,boolean>>
104
+ * Default value is `false`
105
+
106
+ Enable or disable logging
107
+
108
+ [id="plugins-{type}s-{plugin}-durable"]
109
+ ===== `durable`
110
+
111
+ * Value type is <<boolean,boolean>>
112
+ * Default value is `true`
113
+
114
+ Is this exchange durable? (aka; Should it survive a broker restart?)
115
+
116
+ [id="plugins-{type}s-{plugin}-exchange"]
117
+ ===== `exchange`
118
+
119
+ * This is a required setting.
120
+ * Value type is <<string,string>>
121
+ * There is no default value for this setting.
122
+
123
+ The name of the exchange
124
+
125
+ [id="plugins-{type}s-{plugin}-exchange_type"]
126
+ ===== `exchange_type`
127
+
128
+ * This is a required setting.
129
+ * Value can be any of: `fanout`, `direct`, `topic`, `x-consistent-hash`, `x-modulus-hash`
130
+ * There is no default value for this setting.
131
+
132
+ The exchange type (fanout, topic, direct)
133
+
134
+ [id="plugins-{type}s-{plugin}-heartbeat"]
135
+ ===== `heartbeat`
136
+
137
+ * Value type is <<number,number>>
138
+ * There is no default value for this setting.
139
+
140
+ Heartbeat delay in seconds. If unspecified no heartbeats will be sent
141
+
142
+ [id="plugins-{type}s-{plugin}-host"]
143
+ ===== `host`
144
+
145
+ * This is a required setting.
146
+ * Value type is <<string,string>>
147
+ * There is no default value for this setting.
148
+
149
+ Common functionality for the rabbitmq input/output
150
+ RabbitMQ server address(es)
151
+ host can either be a single host, or a list of hosts
152
+ i.e.
153
+ host => "localhost"
154
+ or
155
+ host => ["host01", "host02]
156
+
157
+ if multiple hosts are provided on the initial connection and any subsequent
158
+ recovery attempts of the hosts is chosen at random and connected to.
159
+ Note that only one host connection is active at a time.
160
+
161
+ [id="plugins-{type}s-{plugin}-key"]
162
+ ===== `key`
163
+
164
+ * Value type is <<string,string>>
165
+ * Default value is `"logstash"`
166
+
167
+ The default codec for this plugin is JSON. You can override this to suit your particular needs however.
168
+ Key to route to by default. Defaults to 'logstash'
169
+
170
+ * Routing keys are ignored on fanout exchanges.
171
+
172
+ [id="plugins-{type}s-{plugin}-passive"]
173
+ ===== `passive`
174
+
175
+ * Value type is <<boolean,boolean>>
176
+ * Default value is `false`
177
+
178
+ Passive queue creation? Useful for checking queue existance without modifying server state
179
+
180
+ [id="plugins-{type}s-{plugin}-password"]
181
+ ===== `password`
182
+
183
+ * Value type is <<password,password>>
184
+ * Default value is `"guest"`
185
+
186
+ RabbitMQ password
187
+
188
+ [id="plugins-{type}s-{plugin}-persistent"]
189
+ ===== `persistent`
190
+
191
+ * Value type is <<boolean,boolean>>
192
+ * Default value is `true`
193
+
194
+ Should RabbitMQ persist messages to disk?
195
+
196
+ [id="plugins-{type}s-{plugin}-port"]
197
+ ===== `port`
198
+
199
+ * Value type is <<number,number>>
200
+ * Default value is `5672`
201
+
202
+ RabbitMQ port to connect on
203
+
204
+ [id="plugins-{type}s-{plugin}-ssl"]
205
+ ===== `ssl`
206
+
207
+ * Value type is <<boolean,boolean>>
208
+ * There is no default value for this setting.
209
+
210
+ Enable or disable SSL.
211
+ Note that by default remote certificate verification is off.
212
+ Specify ssl_certificate_path and ssl_certificate_password if you need
213
+ certificate verification
214
+
215
+ [id="plugins-{type}s-{plugin}-ssl_certificate_password"]
216
+ ===== `ssl_certificate_password`
217
+
218
+ * Value type is <<string,string>>
219
+ * There is no default value for this setting.
220
+
221
+ Password for the encrypted PKCS12 (.p12) certificate file specified in ssl_certificate_path
222
+
223
+ [id="plugins-{type}s-{plugin}-ssl_certificate_path"]
224
+ ===== `ssl_certificate_path`
225
+
226
+ * Value type is <<path,path>>
227
+ * There is no default value for this setting.
228
+
229
+ Path to an SSL certificate in PKCS12 (.p12) format used for verifying the remote host
230
+
231
+ [id="plugins-{type}s-{plugin}-ssl_version"]
232
+ ===== `ssl_version`
233
+
234
+ * Value type is <<string,string>>
235
+ * Default value is `"TLSv1.2"`
236
+
237
+ Version of the SSL protocol to use.
238
+
239
+ [id="plugins-{type}s-{plugin}-tls_certificate_password"]
240
+ ===== `tls_certificate_password` (DEPRECATED)
241
+
242
+ * DEPRECATED WARNING: This configuration item is deprecated and may not be available in future versions.
243
+ * Value type is <<string,string>>
244
+ * There is no default value for this setting.
245
+
246
+ TLS certificate password
247
+
248
+ [id="plugins-{type}s-{plugin}-tls_certificate_path"]
249
+ ===== `tls_certificate_path` (DEPRECATED)
250
+
251
+ * DEPRECATED WARNING: This configuration item is deprecated and may not be available in future versions.
252
+ * Value type is <<path,path>>
253
+ * There is no default value for this setting.
254
+
255
+ TLS certifcate path
256
+
257
+ [id="plugins-{type}s-{plugin}-user"]
258
+ ===== `user`
259
+
260
+ * Value type is <<string,string>>
261
+ * Default value is `"guest"`
262
+
263
+ RabbitMQ username
264
+
265
+ [id="plugins-{type}s-{plugin}-vhost"]
266
+ ===== `vhost`
267
+
268
+ * Value type is <<string,string>>
269
+ * Default value is `"/"`
270
+
271
+ The vhost (virtual host) to use. If you don't know what this
272
+ is, leave the default. With the exception of the default
273
+ vhost ("/"), names of vhosts should not begin with a forward
274
+ slash.
275
+
276
+
277
+
278
+ [id="plugins-{type}s-{plugin}-common-options"]
279
+ include::{include_path}/{type}.asciidoc[]
@@ -1,6 +1,8 @@
1
1
  # encoding: UTF-8
2
2
  require "logstash/pipeline"
3
3
  require "logstash/plugin_mixins/rabbitmq_connection"
4
+ java_import java.util.concurrent.TimeoutException
5
+ java_import com.rabbitmq.client.AlreadyClosedException
4
6
 
5
7
  # Push events to a RabbitMQ exchange. Requires RabbitMQ 2.x
6
8
  # or later version (3.x is recommended).
@@ -52,7 +54,7 @@ module LogStash
52
54
  def publish(event, message)
53
55
  raise ArgumentError, "No exchange set in HareInfo!!!" unless @hare_info.exchange
54
56
  @hare_info.exchange.publish(message, :routing_key => event.sprintf(@key), :properties => { :persistent => @persistent })
55
- rescue MarchHare::Exception, IOError, com.rabbitmq.client.AlreadyClosedException => e
57
+ rescue MarchHare::Exception, IOError, AlreadyClosedException, TimeoutException => e
56
58
  @logger.error("Error while publishing. Will retry.",
57
59
  :message => e.message,
58
60
  :exception => e.class,
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-rabbitmq'
3
- s.version = '4.0.7'
3
+ s.version = '4.0.8'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "Push events to a RabbitMQ exchange"
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.require_paths = ["lib"]
11
11
 
12
12
  # Files
13
- s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
13
+ s.files = Dir["lib/**/*","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "docs/**/*"]
14
14
 
15
15
  # Tests
16
16
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
@@ -2,6 +2,7 @@
2
2
  require "logstash/devutils/rspec/spec_helper"
3
3
  require "logstash/pipeline"
4
4
  require "logstash/outputs/rabbitmq"
5
+ java_import java.util.concurrent.TimeoutException
5
6
 
6
7
  describe LogStash::Outputs::RabbitMQ do
7
8
  let(:klass) { LogStash::Outputs::RabbitMQ }
@@ -24,6 +25,25 @@ describe LogStash::Outputs::RabbitMQ do
24
25
  let(:instance) { klass.new(rabbitmq_settings) }
25
26
  let(:hare_info) { instance.instance_variable_get(:@hare_info) }
26
27
 
28
+ shared_examples 'recovers from exception gracefully' do
29
+ it 'should execute publish twice due to a retry' do
30
+ expect(exchange).to have_received(:publish).twice
31
+ end
32
+
33
+ it 'should sleep for the retry' do
34
+ expect(instance).to have_received(:sleep_for_retry).once
35
+ end
36
+
37
+ it 'should send the correct message (twice)' do
38
+ expect(exchange).to have_received(:publish).with(encoded_event, anything).twice
39
+ end
40
+
41
+ it 'should send the correct metadata (twice)' do
42
+ expected_metadata = {:routing_key => event.sprintf(key), :properties => {:persistent => persistent }}
43
+ expect(exchange).to have_received(:publish).with(anything, expected_metadata).twice
44
+ end
45
+ end
46
+
27
47
  it "should register as an output plugin" do
28
48
  expect(LogStash::Plugin.lookup("output", "rabbitmq")).to eql(LogStash::Outputs::RabbitMQ)
29
49
  end
@@ -76,35 +96,34 @@ describe LogStash::Outputs::RabbitMQ do
76
96
  end
77
97
  end
78
98
 
79
- context "when a MarchHare::Exception is encountered" do
99
+ context 'when an exception is encountered' do
100
+ let(:exception) { nil }
101
+
80
102
  before do
81
103
  i = 0
82
104
  allow(instance).to receive(:connect!)
83
105
  allow(instance).to receive(:sleep_for_retry)
84
106
  allow(exchange).to receive(:publish).with(any_args) do
85
107
  i += 1
86
- raise(MarchHare::Exception, "foo") if i == 1
108
+ raise exception if i == 1
87
109
  end
88
110
 
89
111
  instance.send(:publish, event, encoded_event)
90
112
  end
91
113
 
92
- it "should execute publish twice due to a retry" do
93
- expect(exchange).to have_received(:publish).twice
114
+ context 'when it is a MarchHare exception' do
115
+ let(:exception) { MarchHare::Exception }
116
+ it_behaves_like 'recovers from exception gracefully'
94
117
  end
95
118
 
96
- it "should sleep for the retry" do
97
- expect(instance).to have_received(:sleep_for_retry).once
119
+ context 'when it is a MarchHare::ChannelAlreadyClosed' do
120
+ let(:exception) { MarchHare::ChannelAlreadyClosed }
121
+ it_behaves_like 'recovers from exception gracefully'
98
122
  end
99
123
 
100
- it "should send the correct message (twice)" do
101
- expect(exchange).to have_received(:publish).with(encoded_event, anything).twice
102
- end
103
-
104
- it "should send the correct metadata (twice)" do
105
- expected_metadata = {:routing_key => event.sprintf(key), :properties => {:persistent => persistent }}
106
-
107
- expect(exchange).to have_received(:publish).with(anything, expected_metadata).twice
124
+ context 'when it is a TimeoutException' do
125
+ let(:exception) { TimeoutException.new }
126
+ it_behaves_like 'recovers from exception gracefully'
108
127
  end
109
128
  end
110
129
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-rabbitmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.7
4
+ version: 4.0.8
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-28 00:00:00.000000000 Z
11
+ date: 2017-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -104,6 +104,7 @@ files:
104
104
  - LICENSE
105
105
  - NOTICE.TXT
106
106
  - README.md
107
+ - docs/index.asciidoc
107
108
  - lib/logstash/outputs/rabbitmq.rb
108
109
  - logstash-output-rabbitmq.gemspec
109
110
  - spec/outputs/rabbitmq_spec.rb