lib/logstash/outputs/zeromq.rb in logstash-output-zeromq-3.0.0 vs lib/logstash/outputs/zeromq.rb in logstash-output-zeromq-3.1.1
- old
+ new
@@ -9,10 +9,13 @@
#
# The default settings will create a publisher connecting to a subscriber
# 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"
default :codec, "json"
@@ -61,17 +64,11 @@
public
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
def close
begin
@@ -79,11 +76,11 @@
rescue RuntimeError => e
@logger.error("Failed to properly teardown ZeroMQ")
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
def server?
@mode == "server"