logstash-input-bunny 0.1.10 → 0.1.11

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: 8238a1a39e481d7fcf15ee72f9bde6bf2ee199e7
4
- data.tar.gz: 39104fa26e88ec08af8d6e9b9cc54c5ccab6d729
3
+ metadata.gz: 6a3d026a10ffe2b4a072e4a5584ef2bd1003db28
4
+ data.tar.gz: fd96ffef182ced185b47afffaf8a6693272c04db
5
5
  SHA512:
6
- metadata.gz: a4fa70c7d75686779ab76f5d11b185a92dd75b53db651ed6da8a8b833fcbff2fa09d4188c933a54b6a5ed2cfaf0ef43245dae5d95908e728d9c5395b30c5b0d2
7
- data.tar.gz: 9b6a99dea0f7253db067d238f75191154fb69757f6fd631460cd6a51acc0c1006e964ab382cf911791d73a262131a5ed785bf41190c579d0d56a5cb774de89ec
6
+ metadata.gz: 478a7b649be84c2b471638313432e8af954d2901aaa748c4c30c4f3324423d39d4fc4d5ff0bbf432723061e9a2eb97e1560bedfbca32c0fc23587e8a1202201c
7
+ data.tar.gz: 0510b6343762f258e8ad974d1d560d378fe829da547810df178b5c24595073b8f4082ab2606a2c588a62cd79b517e2a47c6463f03d2115ed6fb07a8ea01cdbe8
@@ -111,14 +111,6 @@ class LogStash::Inputs::Bunny < LogStash::Inputs::Threadable
111
111
  super
112
112
  end
113
113
 
114
- def consumer_id
115
- @consumer_id ||= "#{`hostname -s`.strip}-#{Thread.current.object_id}"
116
- end
117
-
118
- def input_name
119
- @exchange.nil? or @key.nil? ? queue : "#{@exchange}:#{@key}"
120
- end
121
-
122
114
  include ::LogStash::Inputs::RabbitMQ::BunnyImpl
123
115
 
124
116
  def run(output_queue)
@@ -175,6 +167,50 @@ class LogStash::Inputs::Bunny < LogStash::Inputs::Threadable
175
167
  finished
176
168
  end
177
169
 
170
+ protected
171
+
172
+ def consumer_id
173
+ @consumer_id ||= "#{`hostname -s`.strip}-#{Thread.current.object_id}"
174
+ end
175
+
176
+ def input_name
177
+ @exchange.nil? or @key.nil? ? queue : "#{@exchange}:#{@key}"
178
+ end
179
+
180
+ def setup
181
+ return if terminating?
182
+
183
+ begin
184
+ attempts ||= 3
185
+
186
+ @logger.debug("RabbitMQ[#{input_name}] connecting.")
187
+ @conn = Bunny.new(@settings)
188
+ @conn.start
189
+ rescue OpenSSL::SSL::SSLError
190
+ @logger.warn("SSL Handshake failed, retrying.")
191
+ attempts -= 1
192
+ retry unless attempts == 0
193
+ end
194
+
195
+ @logger.info("RabbitMQ[#{input_name}] connected at #{@settings[:host]}")
196
+ @ch = @conn.create_channel.tap do |ch|
197
+ ch.prefetch(@prefetch_count)
198
+ end
199
+
200
+ @arguments_hash = Hash[*@arguments]
201
+ @q = @ch.queue(@queue,
202
+ :durable => @durable,
203
+ :auto_delete => @auto_delete,
204
+ :exclusive => @exclusive,
205
+ :passive => @passive,
206
+ :arguments => @arguments)
207
+
208
+ # exchange binding is optional for the input
209
+ if @exchange
210
+ @q.bind(@exchange, :routing_key => @key)
211
+ end
212
+ end
213
+
178
214
  def consume
179
215
  @logger.info("Will consume events from queue #{@q.name} as #{consumer_id}")
180
216
 
@@ -193,5 +229,6 @@ class LogStash::Inputs::Bunny < LogStash::Inputs::Threadable
193
229
 
194
230
  @q.subscribe_with(@consumer, block: true)
195
231
  end
232
+
196
233
  end # class LogStash::Inputs::RabbitMQ
197
234
 
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-bunny'
4
- s.version = '0.1.10'
4
+ s.version = '0.1.11'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Pull events from a RabbitMQ exchange."
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/plugin install gemname. This gem is not a stand-alone program"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-bunny
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Serafini