Exemple #1
0
        /// <summary>
        /// Extension method for adding the MongoDB watcher to the the WardenConfiguration with the default name of MongoDB Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="configuration">Configuration of MongoDbWatcher.</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 AddMongoDbWatcher(
            this WardenConfiguration.Builder builder,
            MongoDbWatcherConfiguration configuration,
            Action <WatcherHooksConfiguration.Builder> hooks = null)
        {
            builder.AddWatcher(MongoDbWatcher.Create(configuration), hooks);

            return(builder);
        }
Exemple #2
0
        /// <summary>
        /// Extension method for adding the MongoDB watcher to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="name">Name of the MongoDbWatcher.</param>
        /// <param name="configuration">Configuration of MongoDbWatcher.</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 AddMongoDbWatcher(
            this WardenConfiguration.Builder builder,
            string name,
            MongoDbWatcherConfiguration configuration,
            Action <WatcherHooksConfiguration.Builder> hooks = null,
            TimeSpan?interval = null)
        {
            builder.AddWatcher(MongoDbWatcher.Create(name, configuration), hooks, interval);

            return(builder);
        }
Exemple #3
0
        protected MongoDbWatcher(string name, MongoDbWatcherConfiguration configuration)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Watcher name can not be empty.");
            }

            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration),
                                                "MongoDB Watcher configuration has not been provided.");
            }

            Name           = name;
            _configuration = configuration;
            _connection    = configuration.ConnectionProvider(configuration.ConnectionString);
        }
Exemple #4
0
 /// <summary>
 /// Factory method for creating a new instance of MongoDbWatcher.
 /// </summary>
 /// <param name="name">Name of the MongoDbWatcher.</param>
 /// <param name="configuration">Configuration of MongoDbWatcher.</param>
 /// <returns>Instance of MongoDbWatcher.</returns>
 public static MongoDbWatcher Create(string name, MongoDbWatcherConfiguration configuration)
 => new MongoDbWatcher(name, configuration);
Exemple #5
0
 /// <summary>
 /// Factory method for creating a new instance of MongoDbWatcher with default name of MongoDB Watcher.
 /// </summary>
 /// <param name="configuration">Configuration of MongoDbWatcher.</param>
 /// <returns>Instance of MongoDbWatcher.</returns>
 public static MongoDbWatcher Create(MongoDbWatcherConfiguration configuration)
 => Create(DefaultName, configuration);
Exemple #6
0
 /// <summary>
 /// Factory method for creating a new instance of MongoDbWatcher.
 /// </summary>
 /// <param name="name">Name of the MongoDbWatcher.</param>
 /// <param name="configuration">Configuration of MongoDbWatcher.</param>
 /// <param name="group">Optional name of the group that MongoDbWatcher belongs to.</param>
 /// <returns>Instance of MongoDbWatcher.</returns>
 public static MongoDbWatcher Create(string name, MongoDbWatcherConfiguration configuration,
                                     string group = null)
 => new MongoDbWatcher(name, configuration, group);
Exemple #7
0
 /// <summary>
 /// Factory method for creating a new instance of MongoDbWatcher with default name of MongoDB Watcher.
 /// </summary>
 /// <param name="configuration">Configuration of MongoDbWatcher.</param>
 /// <param name="group">Optional name of the group that MongoDbWatcher belongs to.</param>
 /// <returns>Instance of MongoDbWatcher.</returns>
 public static MongoDbWatcher Create(MongoDbWatcherConfiguration configuration,
                                     string group = null)
 => Create(DefaultName, configuration, group);
 public Default(MongoDbWatcherConfiguration configuration) : base(configuration)
 {
     SetInstance(this);
 }
 protected Configurator(MongoDbWatcherConfiguration configuration) : base(configuration)
 {
 }
 protected Configurator(string connectionString, string database, TimeSpan?timeout = null)
 {
     Configuration = new MongoDbWatcherConfiguration(connectionString, database, timeout);
 }