class Protobuf::Rpc::Connectors::Zmq

def lookup_server_uri


to the host and port in the options
directory. If the service directory is not running, default
Lookup a server uri for the requested service in the service
def lookup_server_uri
  server_lookup_attempts.times do
    first_alive_listing = service_directory.all_listings_for(service).find do |listing|
      host_alive?(listing.try(:address))
    end
    if first_alive_listing
      host = first_alive_listing.try(:address)
      port = first_alive_listing.try(:port)
      @stats.server = [port, host]
      return "tcp://#{host}:#{port}"
    end
    host = options[:host]
    port = options[:port]
    if host_alive?(host)
      @stats.server = [port, host]
      return "tcp://#{host}:#{port}"
    end
    sleep(1.0 / 100.0)
  end
  fail "Host not found for service #{service}"
end