Sha256: 4b9263a19779e3c8add53f3a0349f6ab5724720f313c0a6b5745b5e40364fdaf
Contents?: true
Size: 1.01 KB
Versions: 7
Compression:
Stored size: 1.01 KB
Contents
require_relative "<%= name.capitalize %>/version" module <%= name.capitalize %> class Main include SubZero::Common def initialize service @config = service.config log "INITing socket" end def poll_sockets print '.' sleep 1 end def ping log "ping..." end ####### private ####### def send_announce_packet $sent = Time.now @socket.send_string "SRV", ZMQ::SNDMORE @socket.send_string 0.to_s, ZMQ::SNDMORE @socket.send_string "UP", ZMQ::SNDMORE payload = { id: @config['service']['id'], sid: @config['service']['sid'] }.to_msgpack @socket.send_string payload end def init_socket @context = ZMQ::Context.new @socket = @context.socket ZMQ::DEALER @socket.identity = @config['service']['id'] @socket.connect "tcp://#{@config['service']['broker_host']}:#{@config['service']['broker_port']}" @poller = ZMQ::Poller.new @poller.register @socket, ZMQ::POLLIN end end end
Version data entries
7 entries across 7 versions & 1 rubygems