Ejemplo n.º 1
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>
        /// <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)
        {
            builder.AddWatcher(RedisWatcher.Create(connectionString, database, timeout), hooks);

            return(builder);
        }
Ejemplo n.º 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="configuration">Configuration of RedisWatcher.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</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)
        {
            builder.AddWatcher(RedisWatcher.Create(configuration), hooks);

            return(builder);
        }
 protected RedisWatcherCheckResult(RedisWatcher watcher, bool isValid, string description,
                                   int database, string connectionString, string query, IEnumerable <dynamic> queryResult)
     : base(watcher, isValid, description)
 {
     Database         = database;
     ConnectionString = connectionString;
     Query            = query;
     QueryResult      = queryResult;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Extension method for adding the Redis watcher to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="name">Name of the RedisWatcher.</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,
            string name,
            RedisWatcherConfiguration configuration,
            Action <WatcherHooksConfiguration.Builder> hooks = null,
            TimeSpan?interval = null)
        {
            builder.AddWatcher(RedisWatcher.Create(name, configuration), hooks, interval);

            return(builder);
        }
Ejemplo n.º 5
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>
        /// <param name="database">Name of the Redis database.</param>
        /// <param name="configurator">Lambda expression for configuring the RedisWatcher.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <param name="timeout">Optional timeout of the Redis query (5 seconds by default).</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,
            Action <RedisWatcherConfiguration.Default> configurator,
            Action <WatcherHooksConfiguration.Builder> hooks = null,
            TimeSpan?timeout  = null,
            TimeSpan?interval = null)
        {
            builder.AddWatcher(RedisWatcher.Create(connectionString, database, timeout, configurator),
                               hooks, interval);

            return(builder);
        }
        /// <summary>
        /// Extension method for adding the Redis watcher to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="name">Name of the RedisWatcher.</param>
        /// <param name="connectionString">Connection string of the Redis database.</param>
        /// <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>
        /// <param name="group">Optional name of the group that param belongs to.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddRedisWatcher(
            this WardenConfiguration.Builder builder,
            string name,
            string connectionString,
            int database,
            TimeSpan?timeout = null,
            Action <WatcherHooksConfiguration.Builder> hooks = null,
            TimeSpan?interval = null,
            string group      = null)
        {
            builder.AddWatcher(RedisWatcher.Create(name, connectionString, database, timeout, group: group),
                               hooks, interval);

            return(builder);
        }
 /// <summary>
 /// Factory method for creating a new instance of RedisWatcherCheckResult.
 /// </summary>
 /// <param name="watcher">Instance of RedisWatcher.</param>
 /// <param name="isValid">Flag determining whether the performed check was valid.</param>
 /// <param name="connectionString">Connection string of the Redis server.</param>
 /// <param name="database">Id of the Redis database.</param>
 /// <param name="query">Redis query.</param>
 /// <param name="queryResult">Collection of dynamic results of the Redis query.</param>
 /// <param name="description">Custom description of the performed check.</param>
 /// <returns>Instance of RedisWatcherCheckResult.</returns>
 public static RedisWatcherCheckResult Create(RedisWatcher watcher, bool isValid,
                                              int database, string connectionString, string query, IEnumerable <dynamic> queryResult,
                                              string description = "")
 => new RedisWatcherCheckResult(watcher, isValid, description, database, connectionString, query,
                                queryResult);
 /// <summary>
 /// Factory method for creating a new instance of RedisWatcherCheckResult.
 /// </summary>
 /// <param name="watcher">Instance of RedisWatcher.</param>
 /// <param name="isValid">Flag determining whether the performed check was valid.</param>
 /// <param name="database">Id of the Redis database.</param>
 /// <param name="connectionString">Connection string of the Redis server.</param>
 /// <param name="description">Custom description of the performed check.</param>
 /// <returns>Instance of RedisWatcherCheckResult.</returns>
 public static RedisWatcherCheckResult Create(RedisWatcher watcher, bool isValid,
                                              int database, string connectionString, string description = "")
 => new RedisWatcherCheckResult(watcher, isValid, description, database,
                                connectionString, string.Empty, Enumerable.Empty <dynamic>());