logstash-input-stomp 3.0.1 → 3.0.2

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: 4293d31a3983f8e3d725a1870d1323a4046b9833
4
- data.tar.gz: 75d2befc5b089e4b8cee5257547f9f89d9dbf5a5
3
+ metadata.gz: d79f4d09d75532cd89359ffe00ae511381ad60eb
4
+ data.tar.gz: e3812a2a26382bbc655fce229902257a1fe41ccb
5
5
  SHA512:
6
- metadata.gz: 78fa6d68fb804449df107c64355ea839ce030cd4832c0a700373160d135f3cb89c007157695af437057b893ed0b77e1cc00622f53b0eb2faad47c73c940997fd
7
- data.tar.gz: b80496e211785f4cfb022cf0989a905a34b0eb91218e50cfe50febdf1b5e21f688d61333e03ff593995b7f78cdbc58beda7785c2f30bc9798bb5192f31911d7d
6
+ metadata.gz: ad205f5b802e08ca657346ee9e7077081c8467e41f187729caeb7a91be8346f659a505d10f28981cc453d6023e00ddbf3bdc2f5d67da0ad18b49f49ecad43698
7
+ data.tar.gz: c096335c508f8a569bfbfe3a55e22761280005bae19a1c5f6afe1f2b073699c583e6467a131d248bfee7bedbb372b0673c885af7af96da1fef9f7c06ecc5ce99
data/CHANGELOG.md CHANGED
@@ -1,12 +1,18 @@
1
+ # 3.0.2
2
+ - Added support for reconnecting when the broker is not available
3
+
1
4
  ## 3.0.1
2
5
  - Relax constraint on logstash-core-plugin-api to >= 1.60 <= 2.99
3
6
 
4
7
  # 3.0.0 (2016-05-20)
5
8
  - Breaking: Updated to use new Java APIs
9
+
6
10
  # 2.0.5
7
11
  - Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
12
+
8
13
  # 2.0.4
9
14
  - New dependency requirements for logstash-core for the 5.0 release
15
+
10
16
  ## 2.0.3
11
17
  - Bugfix https://github.com/logstash-plugins/logstash-input-stomp/issues/10
12
18
 
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  require "logstash/inputs/base"
3
3
  require "logstash/namespace"
4
- require 'pp'
4
+ require "pp"
5
5
 
6
6
  class LogStash::Inputs::Stomp < LogStash::Inputs::Base
7
7
  attr_accessor :client
@@ -30,6 +30,12 @@ class LogStash::Inputs::Stomp < LogStash::Inputs::Base
30
30
  # The vhost to use
31
31
  config :vhost, :validate => :string, :default => nil
32
32
 
33
+ # Auto reconnect
34
+ config :reconnect, :validate => :boolean, :default => true
35
+
36
+ #Auto reconnect interval in seconds
37
+ config :reconnect_interval, :validate => :number, :default => 30
38
+
33
39
  # Enable debugging output?
34
40
  config :debug, :validate => :boolean, :default => false
35
41
 
@@ -37,19 +43,24 @@ class LogStash::Inputs::Stomp < LogStash::Inputs::Base
37
43
  def connect
38
44
  begin
39
45
  @client.connect
40
- @logger.debug? && @logger.debug("Connected to stomp server") if @client.connected?
41
- rescue OnStomp::ConnectFailedError, OnStomp::UnsupportedProtocolVersionError=> e
42
- @logger.warn("Failed to connect to stomp server, will retry", :exception => e, :backtrace => e.backtrace)
43
- if stop?
44
- sleep 2
46
+ @logger.info("Connected to stomp server") if @client.connected?
47
+ rescue OnStomp::ConnectFailedError, OnStomp::UnsupportedProtocolVersionError, Errno::ECONNREFUSED => e
48
+ if @reconnect
49
+ @logger.warn("Failed to connect to stomp server. Retry in #{@reconnect_interval} seconds. #{e.inspect}")
50
+ @logger.debug("#{e.backtrace.join("\n")}") if @debug
51
+ sleep @reconnect_interval
45
52
  retry
46
53
  end
54
+ @logger.warn("Failed to connect to stomp server. Exiting with error: #{e.inspect}")
55
+ @logger.debug("#{e.backtrace.join("\n")}") if @debug
56
+ stop?
47
57
  end
48
58
  end
49
59
 
50
60
  public
51
61
  def register
52
62
  require "onstomp"
63
+
53
64
  @client = new_client
54
65
  @client.host = @vhost if @vhost
55
66
  @stomp_url = "stomp://#{@user}:#{@password}@#{@host}:#{@port}/#{@destination}"
@@ -59,6 +70,7 @@ class LogStash::Inputs::Stomp < LogStash::Inputs::Base
59
70
  connect
60
71
  subscription_handler # is required for re-subscribing to the destination
61
72
  }
73
+
62
74
  connect
63
75
  end # def register
64
76
 
@@ -68,6 +80,9 @@ class LogStash::Inputs::Stomp < LogStash::Inputs::Base
68
80
 
69
81
  private
70
82
  def subscription_handler
83
+ #Exit function when connection is not active
84
+ return if !@client.connected?
85
+
71
86
  @client.subscribe(@destination) do |msg|
72
87
  @codec.decode(msg.body) do |event|
73
88
  decorate(event)
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-stomp'
4
- s.version = '3.0.1'
4
+ s.version = '3.0.2'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Pull events from a stomp server"
7
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"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-stomp
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.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: 2016-07-14 00:00:00.000000000 Z
11
+ date: 2016-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  requirements: []
111
111
  rubyforge_project:
112
- rubygems_version: 2.6.3
112
+ rubygems_version: 2.4.8
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: Pull events from a stomp server