Example #1
0
        /// <summary>
        /// Extension method for adding the Server watcher to the the WardenConfiguration with the default name of Server Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="hostname">Hostname to be resolved.</param>
        /// <param name="port">Optional port number of the hostname (0 means not specified).</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 hostname,
            int port = 0,
            Action<WatcherHooksConfiguration.Builder> hooks = null,
            TimeSpan? interval = null)
        {
            builder.AddWatcher(ServerWatcher.Create(hostname, port), hooks, interval);

            return builder;
        }
Example #2
0
        /// <summary>
        /// Extension method for adding the Redis watcher to the the WardenConfiguration with the default name of Redis Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="connectionString">Connection string of the Redis database.</param>m
        /// <param name="database">Name of the Redis database.</param>
        /// <param name="timeout">Optional timeout of the Redis query (5 seconds by default).</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 AddRedisWatcher(
            this WardenConfiguration.Builder builder,
            string connectionString,
            int database,
            TimeSpan? timeout = null,
            Action<WatcherHooksConfiguration.Builder> hooks = null,
            TimeSpan? interval = null)
        {
            builder.AddWatcher(RedisWatcher.Create(connectionString, database, timeout),
                hooks, interval);

            return builder;
        }
Example #3
0
        /// <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;
        }
Example #4
0
        /// <summary>
        /// Extension method for adding the Redis watcher to the the WardenConfiguration with the default name of Redis Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="configuration">Configuration of RedisWatcher.</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 AddRedisWatcher(
            this WardenConfiguration.Builder builder,
            RedisWatcherConfiguration configuration,
            Action<WatcherHooksConfiguration.Builder> hooks = null,
            TimeSpan? interval = null)
        {
            builder.AddWatcher(RedisWatcher.Create(configuration), hooks, interval);

            return builder;
        }