Пример #1
0
        private IConnectionFactory CreateFactory(AmetistaConfiguration configuration)
        {
            var factory = new ConnectionFactory()
            {
                HostName = configuration.ConnectionStrings.EventBusHostname,
            };

            if (!string.IsNullOrEmpty(configuration.ConnectionStrings.EventBusUsername))
            {
                factory.UserName = configuration.ConnectionStrings.EventBusUsername;
            }

            if (!string.IsNullOrEmpty(configuration.ConnectionStrings.EventBusPassword))
            {
                factory.Password = configuration.ConnectionStrings.EventBusPassword;
            }

            return(factory);
        }
Пример #2
0
 public ReadDbContext(AmetistaConfiguration ametistaConfiguration)
 {
     _mongoClient = new MongoClient(ametistaConfiguration.ConnectionStrings.MongoConnectionString);
     _database    = _mongoClient.GetDatabase(ametistaConfiguration.ConnectionStrings.MongoDatabase);
     Map();
 }
 public RedisCache(AmetistaConfiguration configuration, ILogger <RedisCache> logger)
 {
     redis   = ConnectionMultiplexer.Connect(configuration.ConnectionStrings.RedisCache);
     db      = redis.GetDatabase();
     _logger = logger;
 }
 public RedisCache(AmetistaConfiguration configuration)
 {
     redis = ConnectionMultiplexer.Connect(configuration.ConnectionStrings.RedisCache);
     db    = redis.GetDatabase();
 }
Пример #5
0
 public RabbitMQPersistentConnection(AmetistaConfiguration configuration, ILogger <RabbitMQPersistentConnection> logger)
 {
     _connectionFactory = CreateFactory(configuration);
     _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
     _retryCount        = configuration.RetryCount ?? 5;
 }