protected AnimalCassandraFactory(string keyspace, ILogger logger, IConsulService consulService)
        {
            var contactPoint = consulService.Get("Hosts/Cassandra/Host").GetAwaiter().GetResult();
            var contactPort  = consulService.Get("Hosts/Cassandra/Port").GetAwaiter().GetResult();
            int portNumber;

            if (!int.TryParse(contactPort, out portNumber))
            {
                throw new InvalidOperationException("Cassndra's port number is not valid.");
            }

            var stopWatch = Stopwatch.StartNew();

            cluster = Cluster.Builder()
                      .AddContactPoints(contactPoint.Split(',').Where(x => !string.IsNullOrWhiteSpace(x)))
                      .WithPort(portNumber)
                      .WithCompression(CompressionType.Snappy)
                      .Build();
            Session = cluster.Connect(keyspace);
            stopWatch.Stop();
            logger.Debug(null, $"CassandraProvider.ctor('{keyspace}') ⌚{stopWatch.ElapsedMilliseconds}ms").GetAwaiter()
            .GetResult();

            Logger             = logger;
            this.consulService = consulService;

            Task.Run(PrepareStatements).GetAwaiter().GetResult();
        }
示例#2
0
 public ConsulServicesRegistry(IConsulService consulService)
 {
     _consulService = consulService;
 }
 public AnimalController(IConsulService consulService, IMediator mediator)
 {
     _mediator = mediator;
 }
示例#4
0
 public App(IConsulService consulService, ILogger <App> logger)
 {
     this.consulService = consulService;
     this.logger        = logger;
 }
示例#5
0
 public MessageSender(IBusFactory busFactory, IConsulService consulService, IContractInitializationService contractInitializationService)
 {
     this.busFactory = busFactory;
     this.consulService = consulService;
     this.contractInitializationService = contractInitializationService;
 }
示例#6
0
 public ValuesController(IConsulService consulService)
 {
     _consulService = consulService;
 }
 public AnimalDbContextFactory(IConsulService consuleService)
 {
     _connectionString = consuleService.Get("ConnectionString").GetAwaiter().GetResult();
 }
示例#8
0
 public SettingsStore(IConsulService consulService)
 {
     this.consulService = consulService;
 }