java_import org.zeromq.ZMQ java_import org.zeromq.ZContext java_import org.zeromq.ZLoop require 'zoomq/server/request_handler' module ZooMQ class Server class Worker attr_reader :server def initialize(server) @server = server @zloop = ZLoop.new @zloop.verbose(true) initialize_socket end def initialize_socket @socket = @server.create_socket(ZMQ::ROUTER) @port = @socket.bind("tcp://*:*") RequestHandler.new(@socket).register(@zloop, self) Thread.current.name = "#{@server.fqdn}:#{@port}" @socket.identity = Thread.current[:name].to_java_bytes end def run @server.log.info("pubdater:worker", run: true, announce: @socket.identity) @server.announce(@socket.identity) @zloop.start end end end end