# File lib/cabin/outputs/zeromq.rb, line 26
  def initialize(addresses, options={})
    options = DEFAULTS.merge(options)

    @topology = options[:topology].to_s
    case @topology
    when "pushpull"
      socket_type = ZMQ::PUSH
    when "pubsub"
      socket_type = ZMQ::PUB
    end

    @topic = options[:topic]
    @socket = CONTEXT.socket(socket_type)
    
    Array(addresses).each do |address|
      error_check @socket.connect(address), "connecting to #{address}"
    end

    error_check @socket.setsockopt(ZMQ::LINGER, options[:linger]), "while setting ZMQ::LINGER to #{options[:linger]}"
    error_check @socket.setsockopt(ZMQ::HWM, options[:hwm]), "while setting ZMQ::HWM to #{options[:hwm]}"

    #TODO use cabin's teardown when it exists
    at_exit do
      teardown
    end

    #define_finalizer
  end