logstash-input-jms 2.0.4-java → 3.0.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90ee9fb9254aa206fc4413c73de2b93f2916700e
4
- data.tar.gz: d2d817a3908358f9dd50323865b421b6a9bc0629
3
+ metadata.gz: 1d6da6295a849725f21b5329a1c8b6ce76678d6f
4
+ data.tar.gz: b5964363f134aa555145b699d99af3df70cdc753
5
5
  SHA512:
6
- metadata.gz: 404e50acea9abe786bc5bbdfc46660a3efb8660a8d9f72465cd083a906c297790fb5acab30da85d10dde26df2a76c0bfd4f024ca0a1622681d792147e945097b
7
- data.tar.gz: b5d1c3ebd6acfa3eef525930aeca6752ba25c376e80addc3a2886bf3afd52140203700755c6d281f86f3f24848f9d17260f7cd7a6bcf33eea63fa7c1732db179
6
+ metadata.gz: 3747e4e2c81817ce2ad2ba18f8b0ffd100ce096cba48a0e6bc67ca21e7d860f052225af31badc4fd3535b15d3c9cde4e31811671d41ce3e1f7b833fb656d2bc9
7
+ data.tar.gz: 6f8dc5e2d7e6f28cfce0d1f3eaf919a0f16bff3d4a754a4c6d6eb71534a0e24bc44fac49a5785a9a2f5edb7dae357947d5e9edf46127ede2fea0759e79d11d0c
data/CHANGELOG.md CHANGED
@@ -1,11 +1,19 @@
1
- # 2.0.4
2
- - Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
3
- # 2.0.3
4
- - New dependency requirements for logstash-core for the 5.0 release
1
+ ## 3.0.0
2
+ - Breaking: Updated plugin to use new Java Event APIs
3
+ - relax logstash-core-plugin-api constrains
4
+ - update .travis.yml
5
+ - fix issue #6 - use missing calls from Plugin API - stop, close, stop?
6
+
7
+ ## 2.0.4
8
+ - Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
9
+
10
+ ## 2.0.3
11
+ - New dependency requirements for logstash-core for the 5.0 release
12
+
5
13
  ## 2.0.0
6
14
  - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
7
15
  instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
8
16
  - Dependency on logstash-core update to 2.0
9
17
 
10
- # 0.1.1
11
- - make the plugin, 1.5 friendly by using logstash-core
18
+ ## 0.1.1
19
+ - make the plugin, 1.5 friendly by using logstash-core
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # Logstash Plugin
2
2
 
3
- [![Build
4
- Status](http://build-eu-00.elastic.co/view/LS%20Plugins/view/LS%20Inputs/job/logstash-plugin-input-jms-unit/badge/icon)](http://build-eu-00.elastic.co/view/LS%20Plugins/view/LS%20Inputs/job/logstash-plugin-input-jms-unit/)
3
+ [![Travis Build Status](https://travis-ci.org/logstash-plugins/logstash-input-jms.svg)](https://travis-ci.org/logstash-plugins/logstash-input-jms)
5
4
 
6
5
  This is a plugin for [Logstash](https://github.com/elastic/logstash).
7
6
 
@@ -83,7 +82,12 @@ gem build logstash-filter-awesome.gemspec
83
82
  ```
84
83
  - Install the plugin from the Logstash home
85
84
  ```sh
86
- bin/plugin install /your/local/plugin/logstash-filter-awesome.gem
85
+ # Logstash 2.3 and higher
86
+ bin/logstash-plugin install --no-verify
87
+
88
+ # Prior to Logstash 2.3
89
+ bin/plugin install --no-verify
90
+
87
91
  ```
88
92
  - Start Logstash and proceed to test the plugin
89
93
 
@@ -7,14 +7,15 @@ require "logstash/namespace"
7
7
  #
8
8
  # For more information about Jms, see <http://docs.oracle.com/javaee/6/tutorial/doc/bncdq.html>
9
9
  # For more information about the Ruby Gem used, see <http://github.com/reidmorrison/jruby-jms>
10
- # Here is a config example :
10
+ # Here is a config example to pull from a queue:
11
11
  # jms {
12
12
  # include_header => false
13
13
  # include_properties => false
14
14
  # include_body => true
15
15
  # use_jms_timestamp => false
16
16
  # interval => 10
17
- # queue_name => "myqueue"
17
+ # destination => "myqueue"
18
+ # pub-sub => false
18
19
  # yaml_file => "~/jms.yml"
19
20
  # yaml_section => "mybroker"
20
21
  # }
@@ -39,8 +40,8 @@ class LogStash::Inputs::Jms < LogStash::Inputs::Threadable
39
40
  # If the JMS Message is a MapMessage, then all the key/value pairs will be added in the Hashmap of the event
40
41
  # StreamMessage and ObjectMessage are not supported
41
42
  config :include_body, :validate => :boolean, :default => true
43
+
42
44
  # Convert the JMSTimestamp header field to the @timestamp value of the event
43
- # Don't use it for now, it is buggy
44
45
  config :use_jms_timestamp, :validate => :boolean, :default => false
45
46
 
46
47
  # Choose an implementation of the run block. Value can be either consumer, async or thread
@@ -57,7 +58,7 @@ class LogStash::Inputs::Jms < LogStash::Inputs::Threadable
57
58
  # This parameter has non influence in the case of a subcribed Topic.
58
59
  config :interval, :validate => :number, :default => 10
59
60
 
60
- # If pub-sub (topic) style should be used or not.
61
+ # If pub-sub (topic) style should be used.
61
62
  config :pub_sub, :validate => :boolean, :default => false
62
63
 
63
64
  # Name of the destination queue or topic to use.
@@ -137,7 +138,7 @@ class LogStash::Inputs::Jms < LogStash::Inputs::Threadable
137
138
  if msg.java_kind_of?(JMS::MapMessage)
138
139
  event = LogStash::Event.new
139
140
  msg.data.each do |field, value|
140
- event[field.to_s] = value # TODO(claveau): needs codec.decode or converter.convert ?
141
+ event.set(field.to_s, value) # TODO(claveau): needs codec.decode or converter.convert ?
141
142
  end
142
143
  elsif msg.java_kind_of?(JMS::TextMessage) || msg.java_kind_of?(JMS::BytesMessage)
143
144
  @codec.decode(msg.to_s) do |event_message|
@@ -152,18 +153,18 @@ class LogStash::Inputs::Jms < LogStash::Inputs::Threadable
152
153
 
153
154
  # Here, we can use the JMS Enqueue timestamp as the @timestamp
154
155
  if @use_jms_timestamp && msg.jms_timestamp
155
- event.timestamp = ::Time.at(msg.jms_timestamp/1000)
156
+ event.set("@timestamp", LogStash::Timestamp.at(msg.jms_timestamp / 1000, (msg.jms_timestamp % 1000) * 1000))
156
157
  end
157
158
 
158
159
  if @include_header
159
160
  msg.attributes.each do |field, value|
160
- event[field.to_s] = value
161
+ event.set(field.to_s, value)
161
162
  end
162
163
  end
163
164
 
164
165
  if @include_properties
165
166
  msg.properties.each do |field, value|
166
- event[field.to_s] = value
167
+ event.set(field.to_s, value)
167
168
  end
168
169
  end
169
170
 
@@ -182,20 +183,19 @@ class LogStash::Inputs::Jms < LogStash::Inputs::Threadable
182
183
  def run_consumer(output_queue)
183
184
  JMS::Connection.session(@jms_config) do |session|
184
185
  destination_key = @pub_sub ? :topic_name : :queue_name
185
- while(true)
186
+ while !stop?
186
187
  session.consume(destination_key => @destination, :timeout=>@timeout, :selector => @selector) do |message|
187
188
  queue_event message, output_queue
189
+ break if stop?
188
190
  end
189
191
  sleep @interval
190
192
  end
191
193
  end
192
- rescue LogStash::ShutdownSignal
193
- # Do nothing, let us quit.
194
194
  rescue => e
195
195
  @logger.warn("JMS Consumer died", :exception => e, :backtrace => e.backtrace)
196
196
  sleep(10)
197
- retry
198
- end # def run
197
+ retry unless stop?
198
+ end # def run_consumer
199
199
 
200
200
  # Consume all available messages on the queue through a listener
201
201
  private
@@ -210,19 +210,15 @@ class LogStash::Inputs::Jms < LogStash::Inputs::Threadable
210
210
  queue_event message, output_queue
211
211
  end
212
212
  connection.start
213
- while(true)
213
+ while !stop?
214
214
  @logger.debug("JMS Thread sleeping ...")
215
215
  sleep @interval
216
216
  end
217
- rescue LogStash::ShutdownSignal
218
- connection.close
219
217
  rescue => e
220
218
  @logger.warn("JMS Consumer died", :exception => e, :backtrace => e.backtrace)
221
219
  sleep(10)
222
- retry
223
- end # def run
224
-
225
-
220
+ retry unless stop?
221
+ end # def run_thread
226
222
 
227
223
  # Consume all available messages on the queue through a listener
228
224
  private
@@ -241,18 +237,16 @@ class LogStash::Inputs::Jms < LogStash::Inputs::Threadable
241
237
  end
242
238
  # Since the on_message handler above is in a separate thread the thread needs
243
239
  # to do some other work. It will just sleep for 10 seconds.
244
- while(true)
240
+ while !stop?
241
+ @logger.debug("JMS Thread sleeping ...")
245
242
  sleep @interval
246
243
  end
247
244
  end
248
- rescue LogStash::ShutdownSignal
249
- # Do nothing, let us quit.
250
245
  rescue => e
251
246
  @logger.warn("JMS Consumer died", :exception => e, :backtrace => e.backtrace)
252
247
  sleep(10)
253
- retry
254
- end # def run
255
-
248
+ retry unless stop?
249
+ end # def run_async
256
250
 
257
251
  public
258
252
  def run(output_queue)
@@ -266,4 +260,15 @@ class LogStash::Inputs::Jms < LogStash::Inputs::Threadable
266
260
  end
267
261
  end # def run
268
262
 
263
+ public
264
+ def close
265
+ @logger.info("Closing JMS connection")
266
+ @connection.close rescue nil
267
+ end # def close
268
+
269
+ public
270
+ def stop
271
+ @logger.info("Stopping JMS consumer")
272
+ @connection.stop rescue nil
273
+ end # def stop
269
274
  end # class LogStash::Inputs::Jms
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-jms'
4
- s.version = '2.0.4'
4
+ s.version = '3.0.0'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Pull events from a JMS topic or queue."
7
- s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
7
+ 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"
8
8
  s.authors = ["Elasticsearch"]
9
9
  s.email = 'info@elasticsearch.com'
10
10
  s.homepage = "http://www.elasticsearch.org/guide/en/logstash/current/index.html"
@@ -20,10 +20,9 @@ Gem::Specification.new do |s|
20
20
  s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
21
21
 
22
22
  # Gem dependencies
23
- s.add_runtime_dependency "logstash-core-plugin-api", "~> 1.0"
24
-
25
- s.add_runtime_dependency 'logstash-codec-json'
26
- s.add_runtime_dependency 'logstash-codec-plain'
23
+ s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
24
+ s.add_runtime_dependency 'logstash-codec-json', '~> 3.0'
25
+ s.add_runtime_dependency 'logstash-codec-plain', '~> 3.0'
27
26
 
28
27
  if RUBY_PLATFORM == 'java'
29
28
  s.platform = RUBY_PLATFORM
metadata CHANGED
@@ -1,57 +1,63 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-jms
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 3.0.0
5
5
  platform: java
6
6
  authors:
7
7
  - Elasticsearch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-24 00:00:00.000000000 Z
11
+ date: 2017-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - "~>"
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '1.60'
19
+ - - "<="
17
20
  - !ruby/object:Gem::Version
18
- version: '1.0'
21
+ version: '2.99'
19
22
  name: logstash-core-plugin-api
20
23
  prerelease: false
21
24
  type: :runtime
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '1.0'
29
+ version: '1.60'
30
+ - - "<="
31
+ - !ruby/object:Gem::Version
32
+ version: '2.99'
27
33
  - !ruby/object:Gem::Dependency
28
34
  requirement: !ruby/object:Gem::Requirement
29
35
  requirements:
30
- - - ">="
36
+ - - "~>"
31
37
  - !ruby/object:Gem::Version
32
- version: '0'
38
+ version: '3.0'
33
39
  name: logstash-codec-json
34
40
  prerelease: false
35
41
  type: :runtime
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - ">="
44
+ - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: '0'
46
+ version: '3.0'
41
47
  - !ruby/object:Gem::Dependency
42
48
  requirement: !ruby/object:Gem::Requirement
43
49
  requirements:
44
- - - ">="
50
+ - - "~>"
45
51
  - !ruby/object:Gem::Version
46
- version: '0'
52
+ version: '3.0'
47
53
  name: logstash-codec-plain
48
54
  prerelease: false
49
55
  type: :runtime
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - ">="
58
+ - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '0'
60
+ version: '3.0'
55
61
  - !ruby/object:Gem::Dependency
56
62
  requirement: !ruby/object:Gem::Requirement
57
63
  requirements:
@@ -80,7 +86,7 @@ dependencies:
80
86
  - - ">="
81
87
  - !ruby/object:Gem::Version
82
88
  version: '0'
83
- description: This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program
89
+ 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
84
90
  email: info@elasticsearch.com
85
91
  executables: []
86
92
  extensions: []