Sha256: bc2b80fd92827d153718c2372f5dcb4976e6dc784cb52725e39cb6bcaf35c08d

Contents?: true

Size: 446 Bytes

Versions: 3

Compression:

Stored size: 446 Bytes

Contents

# encoding: utf-8
require 'ffi-rzmq'

class ZeroMQClient

  attr_reader :addr, :port, :context, :requester

  def initialize(addr, port)
    @addr   = addr
    @port   = port
    @context = ZMQ::Context.new(1)
    @requester = context.socket(ZMQ::PUB)
    @requester.connect("tcp://#{addr}:#{port}")
  end

  def send(data, flags=0)
    @requester.send_string(data, flags)
  end

  def close
    @requester.close
    @context.terminate
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
logstash-input-zeromq-3.0.5 spec/support/client.rb
logstash-input-zeromq-3.0.3 spec/support/client.rb
logstash-input-zeromq-3.0.0 spec/support/client.rb