/// <summary> /// Extension method for adding the Server watcher to the the WardenConfiguration. /// </summary> /// <param name="builder">Instance of the Warden configuration builder.</param> /// <param name="name">Name of the ServerWatcher.</param> /// <param name="configuration">Configuration of ServerWatcher.</param> /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param> /// <param name="interval">Optional interval (5 seconds by default) after which the next check will be invoked.</param> /// <returns>Instance of fluent builder for the WardenConfiguration.</returns> public static WardenConfiguration.Builder AddServerWatcher( this WardenConfiguration.Builder builder, string name, ServerWatcherConfiguration configuration, Action <WatcherHooksConfiguration.Builder> hooks = null, TimeSpan?interval = null) { builder.AddWatcher(ServerWatcher.Create(name, configuration), hooks, interval); return(builder); }
protected ServerWatcher(string name, ServerWatcherConfiguration configuration) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Watcher name can not be empty."); } if (configuration == null) { throw new ArgumentNullException(nameof(configuration), "Server watcher configuration has not been provided."); } Name = name; _configuration = configuration; }
/// <summary> /// Factory method for creating a new instance of ServerWatcher with default name of Server watcher. /// </summary> /// <param name="configuration">Configuration of ServerWatcher.</param> /// <returns>A ServerWatcher instance.</returns> public static ServerWatcher Create(ServerWatcherConfiguration configuration) => new ServerWatcher(DefaultName, configuration);
/// <summary> /// Factory method for creating a new instance of ServerWatcher. /// </summary> /// <param name="name">Name of the ServerWatcher.</param> /// <param name="configuration">Configuration of ServerWatcher.</param> /// <returns>A ServerWatcher instance.</returns> public static ServerWatcher Create(string name, ServerWatcherConfiguration configuration) => new ServerWatcher(name, configuration);
/// <summary> /// Factory method for creating a new instance of ServerWatcher. /// </summary> /// <param name="name">Name of the ServerWatcher.</param> /// <param name="configuration">Configuration of ServerWatcher.</param> /// <param name="group">Optional name of the group that ServerWatcher belongs to.</param> /// <returns>A ServerWatcher instance.</returns> public static ServerWatcher Create(string name, ServerWatcherConfiguration configuration, string group = null) => new ServerWatcher(name, configuration, group);
/// <summary> /// Factory method for creating a new instance of ServerWatcher with default name of Server watcher. /// </summary> /// <param name="configuration">Configuration of ServerWatcher.</param> /// <param name="group">Optional name of the group that ServerWatcher belongs to.</param> /// <returns>A ServerWatcher instance.</returns> public static ServerWatcher Create(ServerWatcherConfiguration configuration, string group = null) => Create(DefaultName, configuration, group);
protected Configurator(string hostname, int port = 0) { ValidateHostnameAndPort(hostname, port); Configuration = new ServerWatcherConfiguration(hostname, port); }
public Default(ServerWatcherConfiguration configuration) : base(configuration) { SetInstance(this); }
protected Configurator(ServerWatcherConfiguration configuration) : base(configuration) { }