Skip to content

Commit f3c9147

Browse files
authored
Refactor: scope (and remove unused) java imports (#29)
1 parent 5448c72 commit f3c9147

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 7.0.3
2+
- Refactor: scope (and remove unused) java imports [#29](https://github.com/logstash-plugins/logstash-integration-rabbitmq/pull/29)
3+
14
## 7.0.2
25
- Fixes issue in Output where failure to register connection reovery hooks prevented the output from starting
36

lib/logstash/inputs/rabbitmq.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
require_relative '../plugin_mixins/rabbitmq_connection'
33
require 'logstash/inputs/threadable'
44
require 'logstash/event'
5-
java_import java.util.concurrent.ArrayBlockingQueue
6-
java_import java.util.concurrent.TimeUnit
75

86
module LogStash
97
module Inputs
@@ -59,6 +57,9 @@ module Inputs
5957
# Additionally, any message headers will be saved in the
6058
# `[@metadata][rabbitmq_headers]` field.
6159
class RabbitMQ < LogStash::Inputs::Threadable
60+
61+
java_import java.util.concurrent.TimeUnit
62+
6263
include ::LogStash::PluginMixins::RabbitMQConnection
6364

6465
# The properties to extract from each message and store in a

lib/logstash/outputs/rabbitmq.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
# encoding: UTF-8
22
require "logstash/pipeline"
33
require_relative '../plugin_mixins/rabbitmq_connection'
4-
java_import java.util.concurrent.TimeoutException
5-
java_import com.rabbitmq.client.AlreadyClosedException
64

75
require 'back_pressure'
86

97
# Push events to a RabbitMQ exchange. Requires RabbitMQ 2.x
108
# or later version (3.x is recommended).
11-
#
9+
#
1210
# Relevant links:
1311
#
1412
# * http://www.rabbitmq.com/[RabbitMQ]
1513
# * http://rubymarchhare.info[March Hare]
1614
module LogStash
1715
module Outputs
1816
class RabbitMQ < LogStash::Outputs::Base
17+
18+
java_import java.util.concurrent.TimeoutException
19+
java_import com.rabbitmq.client.AlreadyClosedException
20+
1921
include LogStash::PluginMixins::RabbitMQConnection
2022

2123
config_name "rabbitmq"
22-
24+
2325
concurrency :shared
2426

2527
# The default codec for this plugin is JSON. You can override this to suit your particular needs however.
@@ -128,4 +130,4 @@ def back_pressure_provider_for_connection(march_hare_connection)
128130
end
129131
end
130132
end
131-
end
133+
end

logstash-integration-rabbitmq.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |s|
22
s.name = 'logstash-integration-rabbitmq'
3-
s.version = '7.0.2'
3+
s.version = '7.0.3'
44
s.licenses = ['Apache License (2.0)']
55
s.summary = "Integration with RabbitMQ - input and output plugins"
66
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline "+

spec/outputs/rabbitmq_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
require "logstash/devutils/rspec/spec_helper"
33
require "logstash/pipeline"
44
require "logstash/outputs/rabbitmq"
5-
java_import java.util.concurrent.TimeoutException
65

76
describe LogStash::Outputs::RabbitMQ do
87
let(:klass) { LogStash::Outputs::RabbitMQ }
@@ -124,7 +123,7 @@
124123
end
125124

126125
context 'when it is a TimeoutException' do
127-
let(:exception) { TimeoutException.new }
126+
let(:exception) { java.util.concurrent.TimeoutException.new }
128127
it_behaves_like 'recovers from exception gracefully'
129128
end
130129
end

0 commit comments

Comments
 (0)