Ejemplo n.º 1
0
        public ServiceBusClient(ServiceBusConfig serviceBusConfig, WriterCosmosDbConfig writerCosmosDbConfig)
        {
            this.writerCosmosDbConfig = writerCosmosDbConfig;
            subscriptionClient        = new SubscriptionClient(serviceBusConfig.ConnectionString, serviceBusConfig.TopicName, serviceBusConfig.SubscriptionName);

            var mongoClient = new MongoClient(writerCosmosDbConfig.ConnectionString);

            cosmosDatabase = mongoClient.GetDatabase(writerCosmosDbConfig.DataBaseId);
        }
Ejemplo n.º 2
0
        private static IConfigurationRoot SetConfiguration()
        {
            readerServiceBusConfig = new ServiceBusConfig();
            writerServiceBusConfig = new ServiceBusConfig();
            writerCosmosDbConfig   = new WriterCosmosDbConfig();

            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json")
                          .AddEnvironmentVariables()
                          .Build();

            builder.GetSection("WriterServiceBusConfig").Bind(writerServiceBusConfig);
            builder.GetSection("ReaderServiceBusConfig").Bind(readerServiceBusConfig);
            builder.GetSection("WriterCosmosDbConfig").Bind(writerCosmosDbConfig);

            return(builder);
        }