From e04f1cc5458f3410890ca0573548190c7e18ab91 Mon Sep 17 00:00:00 2001 From: Andrew Cholakian Date: Fri, 26 Aug 2016 09:03:59 -0500 Subject: [PATCH] Move to concurrency :single --- CHANGELOG.md | 5 +++++ lib/logstash/outputs/zeromq.rb | 13 +++++-------- logstash-output-zeromq.gemspec | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe56c5c..2b5c7dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 3.1.0 + - Move to concurrency :single for safety. This may cause some slowdown in + client mode, but is the easiest upgrade path. Moving to :shared would be nice + at some point. + ## 3.0.2 - Relax constraint on logstash-core-plugin-api to >= 1.60 <= 2.99 diff --git a/lib/logstash/outputs/zeromq.rb b/lib/logstash/outputs/zeromq.rb index a856a35..54378da 100644 --- a/lib/logstash/outputs/zeromq.rb +++ b/lib/logstash/outputs/zeromq.rb @@ -11,6 +11,9 @@ # bound to tcp://127.0.0.1:2120 # class LogStash::Outputs::ZeroMQ < LogStash::Outputs::Base + # This will be a performance bottleneck. Someone needs to upgrade this to + # concurrency :shared and make sure there is no breakage + concurrency :single config_name "zeromq" @@ -63,13 +66,7 @@ class LogStash::Outputs::ZeroMQ < LogStash::Outputs::Base def register load_zmq - if @mode == "server" - workers_not_supported("With 'mode => server', only one zeromq socket may bind to a port and may not be shared among threads. Going to single-worker mode for this plugin!") - end - connect - - @codec.on_event(&method(:publish)) end # def register public @@ -81,8 +78,8 @@ def close end end # def close - def receive(event) - @codec.encode(event) + def multi_receive_encoded(events_and_encoded) + events_and_encoded.each {|event, encoded| self.publish(event,encoded)} end private diff --git a/logstash-output-zeromq.gemspec b/logstash-output-zeromq.gemspec index 15c5942..e285bfe 100644 --- a/logstash-output-zeromq.gemspec +++ b/logstash-output-zeromq.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = 'logstash-output-zeromq' - s.version = '3.0.2' + s.version = '3.1.0' s.licenses = ['Apache License (2.0)'] s.summary = "Write events to a 0MQ socket." 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" @@ -20,7 +20,7 @@ Gem::Specification.new do |s| s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" } # Gem dependencies - s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99" + s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60.1", "< 2.99" s.add_runtime_dependency 'logstash-codec-json' s.add_runtime_dependency 'logstash-mixin-zeromq', '>= 2.0.0'