logstash-input-example 2.0.1 → 2.0.2

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: c5999dde7d210b23efff39d05df637db9bedf890
4
- data.tar.gz: bbf03a9d443c127aab524ecd778ee9e66dfbfb59
3
+ metadata.gz: 3d1a28be03096130cfc469a611324162d70f1176
4
+ data.tar.gz: 6db0d90c44d6fa0f407edc9358f97d99dee1e0c0
5
5
  SHA512:
6
- metadata.gz: deeeb195e1a31a7ab102329ab101afac0092c0f5b1451af801300627b22f11e4e2daa63ab9b58c0b6033d9a719609f348004fabc4fb39a945692be7465087b80
7
- data.tar.gz: 2601d27feca6808c336c4327c9e9085744bbd24fc30cd44d8637d58d390b4274a1e3f15c277eb8734f9914efd249b03742ee0a4c85f655c5fa11a657cc145892
6
+ metadata.gz: a5320a3e9ba1d31c7b2569085006e113a2e78081120a06feca35eaf84f1cf4eaa0c2449724ac9114b6e7d331bacfbf299e71a87e8b3d315592654e14673553d4
7
+ data.tar.gz: 9a910c49853e93c4bae562580a69e1773a0c8ebd06e311a4de01edcaea7630b191e036f8dadd1a38e9c3b72b2481e556af35dd1d26704e34e6a1c53e17f37418
data/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ ## 2.0.1
2
+ - Simplify the shutdown implementation a bit for easier understanding
1
3
  ## 2.0.0
2
4
  - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
3
5
  instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
@@ -28,21 +28,24 @@ class LogStash::Inputs::Example < LogStash::Inputs::Base
28
28
  end # def register
29
29
 
30
30
  def run(queue)
31
- # This plugin uses Stud.interval. Because we want it to be able to stop
32
- # cleanly, we need to keep access to the current thread. It is referenced
33
- # in the stop method below.
34
- #
35
- # Other plugins may require similar access to the current thread.
36
- @thread = Thread.current
37
-
38
- Stud.interval(@interval) do
31
+ # we can abort the loop if stop? becomes true
32
+ while !stop?
39
33
  event = LogStash::Event.new("message" => @message, "host" => @host)
40
34
  decorate(event)
41
35
  queue << event
36
+ # because the sleep interval can be big, when shutdown happens
37
+ # we want to be able to abort the sleep
38
+ # Stud.stoppable_sleep will frequently evaluate the given block
39
+ # and abort the sleep(@interval) if the return value is true
40
+ Stud.stoppable_sleep(@interval) { stop? }
42
41
  end # loop
43
42
  end # def run
44
43
 
45
44
  def stop
46
- Stud.stop!(@thread)
45
+ # nothing to do in this case so it is not necessary to define stop
46
+ # examples of common "stop" tasks:
47
+ # * close sockets (unblocking blocking reads/accepts)
48
+ # * cleanup temporary files
49
+ # * terminate spawned threads
47
50
  end
48
51
  end # class LogStash::Inputs::Example
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-example'
3
- s.version = '2.0.1'
3
+ s.version = '2.0.2'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "This example input streams a string at a definable interval."
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/plugin install gemname. This gem is not a stand-alone program"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-example
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-08 00:00:00.000000000 Z
11
+ date: 2015-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement