Sha256: b93f1cf57c5be3029c54862433a53eef48544a3fed4e4ee88502925351d65db4

Contents?: true

Size: 430 Bytes

Versions: 4

Compression:

Stored size: 430 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)
    @requester.send_string(data)
  end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
logstash-input-zeromq-2.0.4 spec/support/client.rb
logstash-input-zeromq-2.0.2 spec/support/client.rb
logstash-input-zeromq-2.0.1 spec/support/client.rb
logstash-input-zeromq-2.0.0 spec/support/client.rb