logstash-output-rabbitmq 5.0.3-java → 5.1.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 +4 -4
- data/CHANGELOG.md +3 -0
- data/LICENSE +1 -1
- data/lib/logstash/outputs/rabbitmq.rb +28 -6
- data/logstash-output-rabbitmq.gemspec +1 -1
- data/spec/outputs/rabbitmq_spec.rb +3 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 803d787d5f5a3fddb6c4d96d06fce0c293f413ae75cbfe2020b16943d754c3ee
|
4
|
+
data.tar.gz: b6e8410d0bc521f557304be2f2d55053fc2dc5b385c9341e604870822ba8b5bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2aacec385fd40029381cf15ee2e0afbfd2eb0c2e9cfac5b7ab385341a70708c0c45a01a6f02df7ed133e93c15603d1edb3d5c24431eb4031a428e32e84ec36c
|
7
|
+
data.tar.gz: b52cf1d8e1adb9dae4827d2e175703c7b90bc6ad6f9cdb3b81a3344948a6d9ef34b5802d84b866646f3628747cdf328b2113215e1394d45f7894aaa8efae2109
|
data/CHANGELOG.md
CHANGED
data/LICENSE
CHANGED
@@ -17,6 +17,8 @@ module LogStash
|
|
17
17
|
include LogStash::PluginMixins::RabbitMQConnection
|
18
18
|
|
19
19
|
config_name "rabbitmq"
|
20
|
+
|
21
|
+
concurrency :shared
|
20
22
|
|
21
23
|
# The default codec for this plugin is JSON. You can override this to suit your particular needs however.
|
22
24
|
default :codec, "json"
|
@@ -44,22 +46,24 @@ module LogStash
|
|
44
46
|
def register
|
45
47
|
connect!
|
46
48
|
@hare_info.exchange = declare_exchange!(@hare_info.channel, @exchange, @exchange_type, @durable)
|
47
|
-
|
49
|
+
# The connection close should close all channels, so it is safe to store thread locals here without closing them
|
50
|
+
@thread_local_channel = java.lang.ThreadLocal.new
|
51
|
+
@thread_local_exchange = java.lang.ThreadLocal.new
|
48
52
|
end
|
49
53
|
|
50
54
|
def symbolize(myhash)
|
51
55
|
Hash[myhash.map{|(k,v)| [k.to_sym,v]}]
|
52
56
|
end
|
53
57
|
|
54
|
-
def
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
+
def multi_receive_encoded(events_and_data)
|
59
|
+
events_and_data.each do |event, data|
|
60
|
+
publish(event, data)
|
61
|
+
end
|
58
62
|
end
|
59
63
|
|
60
64
|
def publish(event, message)
|
61
65
|
raise ArgumentError, "No exchange set in HareInfo!!!" unless @hare_info.exchange
|
62
|
-
|
66
|
+
local_exchange.publish(message, :routing_key => event.sprintf(@key), :properties => symbolize(@message_properties.merge(:persistent => @persistent)))
|
63
67
|
rescue MarchHare::Exception, IOError, AlreadyClosedException, TimeoutException => e
|
64
68
|
@logger.error("Error while publishing. Will retry.",
|
65
69
|
:message => e.message,
|
@@ -70,6 +74,24 @@ module LogStash
|
|
70
74
|
retry
|
71
75
|
end
|
72
76
|
|
77
|
+
def local_exchange
|
78
|
+
exchange = @thread_local_exchange.get
|
79
|
+
if !exchange
|
80
|
+
exchange = declare_exchange!(local_channel, @exchange, @exchange_type, @durable)
|
81
|
+
@thread_local_exchange.set(exchange)
|
82
|
+
end
|
83
|
+
exchange
|
84
|
+
end
|
85
|
+
|
86
|
+
def local_channel
|
87
|
+
channel = @thread_local_channel.get
|
88
|
+
if !channel
|
89
|
+
channel = @hare_info.connection.create_channel
|
90
|
+
@thread_local_channel.set(channel)
|
91
|
+
end
|
92
|
+
channel
|
93
|
+
end
|
94
|
+
|
73
95
|
def close
|
74
96
|
close_connection
|
75
97
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-rabbitmq'
|
3
|
-
s.version = '5.0
|
3
|
+
s.version = '5.1.0'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = "Pushes events to a RabbitMQ exchange"
|
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/logstash-plugin install gemname. This gem is not a stand-alone program"
|
@@ -163,6 +163,7 @@ describe "with a live server", :integration => true do
|
|
163
163
|
sleep 1
|
164
164
|
end
|
165
165
|
let(:message) { LogStash::Event.new("message" => "Foo Message", "extra_field" => "Blah") }
|
166
|
+
let(:encoded) { message.to_json }
|
166
167
|
let(:test_connection) { MarchHare.connect(instance.send(:rabbitmq_settings)) }
|
167
168
|
let(:test_channel) { test_connection.create_channel }
|
168
169
|
let(:test_queue) {
|
@@ -196,7 +197,7 @@ describe "with a live server", :integration => true do
|
|
196
197
|
end
|
197
198
|
|
198
199
|
it 'applies per message settings' do
|
199
|
-
instance.
|
200
|
+
instance.multi_receive_encoded([[message, encoded]])
|
200
201
|
sleep 1.0
|
201
202
|
|
202
203
|
message, payload = test_queue.pop
|
@@ -213,7 +214,7 @@ describe "with a live server", :integration => true do
|
|
213
214
|
@received = payload
|
214
215
|
end
|
215
216
|
|
216
|
-
instance.
|
217
|
+
instance.multi_receive_encoded([[message, encoded]])
|
217
218
|
|
218
219
|
until @received
|
219
220
|
sleep 1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-rabbitmq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0
|
4
|
+
version: 5.1.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
134
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.6.
|
135
|
+
rubygems_version: 2.6.13
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: Pushes events to a RabbitMQ exchange
|