Class: ZMQMachine::Device::Queue::XRepHandler

Inherits:
XReqHandler
  • Object
show all
Defined in:
lib/zm/device/queue.rb

Overview

class XReqHandler

Instance Attribute Summary

Attributes inherited from XReqHandler

#socket_out

Instance Method Summary collapse

Methods inherited from XReqHandler

#error_check, #initialize, #on_attach, #on_writable, #set_options

Constructor Details

This class inherits a constructor from ZMQMachine::Device::Queue::XReqHandler

Instance Method Details

#on_readable(socket, messages, envelope) ⇒ Object



136
137
138
139
140
141
142
143
144
145
# File 'lib/zm/device/queue.rb', line 136

def on_readable(socket, messages, envelope)
  all = envelope + messages
  all.each { |msg| @reactor.log(:device, "[Q#{@direction}] [#{msg.copy_out_string}]") } if @verbose

  if @socket_out
    # FIXME: need to be able to handle EAGAIN/failed send
    rc = socket_out.send_messages(all)
    all.each { |message| message.close }
  end
end