public MongoRabbitConnection(MongoRabbitScaleoutConfiguration configuration) : base(configuration) { var mongoUrl = new MongoUrl(configuration.MongoConnectionString); var mongoClient = new MongoClient(mongoUrl); var database = mongoClient.GetDatabase(mongoUrl.DatabaseName); _collection = database.GetCollection <MongoRabbitCount>(CollectionName); _bus = configuration.Bus != null ? configuration.Bus.Advanced : RabbitHutch.CreateBus(configuration.AmpqConnectionString).Advanced; //wire up the reconnection handler _bus.Connected += OnReconnection; //wire up the disconnection handler _bus.Disconnected += OnDisconnection; }
public MongoRabbitConnection(MongoRabbitScaleoutConfiguration configuration) : base(configuration) { if (string.IsNullOrEmpty(configuration.MongoConnectionString)) { throw new ArgumentNullException(nameof(configuration.MongoConnectionString), "Connection string cannot be null or empty"); } if (string.IsNullOrEmpty(configuration.CollectionName)) { throw new ArgumentNullException(nameof(configuration.CollectionName), "Collection name cannot be null or empty"); } _configuration = configuration; var mongoUrl = new MongoUrl(configuration.MongoConnectionString); var mongoClient = new MongoClient(mongoUrl); var database = mongoClient.GetDatabase(mongoUrl.DatabaseName); _collection = database.GetCollection<MongoRabbitCount>(configuration.CollectionName); }
public MongoRabbitConnection(MongoRabbitScaleoutConfiguration configuration) : base(configuration) { if (string.IsNullOrEmpty(configuration.MongoConnectionString)) { throw new ArgumentNullException(nameof(configuration.MongoConnectionString), "Connection string cannot be null or empty"); } if (string.IsNullOrEmpty(configuration.CollectionName)) { throw new ArgumentNullException(nameof(configuration.CollectionName), "Collection name cannot be null or empty"); } _configuration = configuration; var mongoUrl = new MongoUrl(configuration.MongoConnectionString); var mongoClient = new MongoClient(mongoUrl); var database = mongoClient.GetDatabase(mongoUrl.DatabaseName); _collection = database.GetCollection <MongoRabbitCount>(configuration.CollectionName); }