logstash-mixin-zeromq 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cec5dfe3f6667e06e871a68fba24a5bf23808a10
4
- data.tar.gz: 66cc806229bdfb70d3cc1e82772459392fa976bd
3
+ metadata.gz: b320269e688ab131038a42709a944cc52431b9a4
4
+ data.tar.gz: b9e7cd554cd196100a14c0823c670c09725ad1b2
5
5
  SHA512:
6
- metadata.gz: 7d04902c5705478eafd9e2356ea0647dc141c0cbcb0bc94f281bb722be63bea81c54aeade0788edbe5e8de08bc3267a203016485db801e016da83dbd9d640a12
7
- data.tar.gz: 4c8010338df5598bf0fee3e0798e8cde399a8e5ed15199f436d01d700807186653d3a4e024d0223f416696b0cfcf115cb3f8a57bec03c8c30a303f940c44e0c7
6
+ metadata.gz: 0a0259f8102693e985f83a6f80eafa62c99ec6ca63bd318b6368be1f12a37fad25087fcfbaab79a9bea776d85e9993053489f4e5808fc97692244cf56820f485
7
+ data.tar.gz: f96239b1f52883b1c2f694fefd6fbedf6ec6e52f6d5b8a055f93b5c92a64f7809f66db1734067bb76126519a431813988d58746a08681f05756264d7a983659f
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012–2015 Elasticsearch <http://www.elastic.co>
1
+ Copyright (c) 2012–2016 Elasticsearch <http://www.elastic.co>
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
@@ -2,13 +2,25 @@
2
2
  require 'ffi-rzmq'
3
3
  require "logstash/namespace"
4
4
 
5
+ class LogStash::PluginMixins::ZeroMQContext
6
+ class << self
7
+ def context
8
+ @context ||= ZMQ::Context.new
9
+ end
10
+ end
11
+ end
12
+
5
13
  module LogStash::PluginMixins::ZeroMQ
6
14
  # LOGSTASH-400
7
15
  # see https://github.com/chuckremes/ffi-rzmq/blob/master/lib/ffi-rzmq/socket.rb#L93-117
8
16
  STRING_OPTS = %w{IDENTITY SUBSCRIBE UNSUBSCRIBE}
9
17
 
10
18
  def context
11
- @context ||= ZMQ::Context.new
19
+ LogStash::PluginMixins::ZeroMQContext.context
20
+ end
21
+
22
+ def terminate_context
23
+ context.terminate
12
24
  end
13
25
 
14
26
  def setup(socket, address)
@@ -17,7 +29,7 @@ module LogStash::PluginMixins::ZeroMQ
17
29
  else
18
30
  error_check(socket.connect(address), "connecting to #{address}")
19
31
  end
20
- @logger.info("0mq: #{server? ? 'connected' : 'bound'}", :address => address)
32
+ @logger.info("0mq: #{server? ? 'bound' : 'connected'}", :address => address)
21
33
  end
22
34
 
23
35
  def error_check(rc, doing, eagain_not_error=false)
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-mixin-zeromq'
4
- s.version = '2.0.1'
4
+ s.version = '2.0.2'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Mixin to share code for zeromq input, output and filter"
7
- s.description = "This gem contains mixin functions, used by 0MQ logstash plugins. This gem is not a stand-alone program"
7
+ 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"
8
8
  s.authors = ["Elastic"]
9
9
  s.email = 'info@elastic.co'
10
10
  s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
@@ -18,6 +18,7 @@ describe LogStash::PluginMixins::ZeroMQ do
18
18
  d.mode = "server"
19
19
  d
20
20
  }
21
+ let(:tracer) { double("logger") }
21
22
 
22
23
  it "should initialize with no extra settings" do
23
24
  expect {
@@ -40,6 +41,13 @@ describe LogStash::PluginMixins::ZeroMQ do
40
41
  it "should setup a server, bind to address without error" do
41
42
  expect { impl.setup(socket, "tcp://127.0.0.1:#{port}") }.to_not raise_error
42
43
  end
44
+
45
+ it "a 'bound' info line is logged" do
46
+ allow(tracer).to receive(:debug)
47
+ impl.logger = tracer
48
+ expect(tracer).to receive(:info).with("0mq: bound", {:address=>"tcp://127.0.0.1:#{port}"})
49
+ impl.setup(socket, "tcp://127.0.0.1:#{port}")
50
+ end
43
51
  end
44
52
 
45
53
  context "a client" do
@@ -49,6 +57,13 @@ describe LogStash::PluginMixins::ZeroMQ do
49
57
  d
50
58
  }
51
59
 
60
+ it "a 'connected' info line is logged" do
61
+ allow(tracer).to receive(:debug)
62
+ impl_client.logger = tracer
63
+ expect(tracer).to receive(:info).with("0mq: connected", {:address=>"tcp://127.0.0.1:#{port}"})
64
+ impl_client.setup(socket, "tcp://127.0.0.1:#{port}")
65
+ end
66
+
52
67
  it "should setup a client, connecting to address without error" do
53
68
  expect { impl_client.setup(socket, "tcp://127.0.0.1:#{port}") }.to_not raise_error
54
69
  end
@@ -100,6 +115,5 @@ describe LogStash::PluginMixins::ZeroMQ do
100
115
  it "should set multiple options" do
101
116
  expect { impl.setopts(socket, { "ZMQ::SNDHWM" => "50", "ZMQ::SNDBUF" => "50" } ) }.to_not raise_error
102
117
  end
103
-
104
118
  end
105
119
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-mixin-zeromq
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-18 00:00:00.000000000 Z
11
+ date: 2016-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -72,7 +72,7 @@ dependencies:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
- description: This gem contains mixin functions, used by 0MQ logstash plugins. This gem is not a stand-alone program
75
+ 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
76
76
  email: info@elastic.co
77
77
  executables: []
78
78
  extensions: []
@@ -85,7 +85,7 @@ files:
85
85
  - NOTICE.TXT
86
86
  - README.md
87
87
  - lib/logstash/plugin_mixins/zeromq.rb
88
- - logstash-util-zeromq.gemspec
88
+ - logstash-mixin-zeromq.gemspec
89
89
  - spec/plugin_mixins/zeromq_spec.rb
90
90
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
91
91
  licenses: