class Synapse::ServiceWatcher

Public Class Methods

create(name, opts, synapse) click to toggle source

the method which actually dispatches watcher creation requests

# File lib/synapse/service_watcher.rb, line 23
def self.create(name, opts, synapse)
  opts['name'] = name

  raise ArgumentError, "Missing discovery method when trying to create watcher" \
    unless opts.has_key?('discovery') && opts['discovery'].has_key?('method')

  discovery_method = opts['discovery']['method']
  raise ArgumentError, "Invalid discovery method #{discovery_method}" \
    unless @watchers.has_key?(discovery_method)

  return @watchers[discovery_method].new(opts, synapse)
end