示例#1
0
        public override bool OnStart()
        {
            _telemetryClient = new TelemetryClient();
            _telemetryClient.InstrumentationKey        = RoleEnvironment.GetConfigurationSettingValue("APPINSIGHTS_INSTRUMENTATIONKEY");
            ServicePointManager.DefaultConnectionLimit = Environment.ProcessorCount * 12;

            _connectionPolicy = new ConnectionPolicy();
            _connectionPolicy.PreferredLocations.Add("North Europe"); // first preference
            _connectionPolicy.PreferredLocations.Add("West Europe");  // second preference
            var sqServiceBusConnectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString.StockQuantity");

            var docDbName         = CloudConfigurationManager.GetSetting("Microsoft.DocumentDB.StockQuantity.DBName");
            var docDbsqColName    = CloudConfigurationManager.GetSetting("Microsoft.DocumentDB.StockQuantity.DBCollectionName");
            var docDbsvColName    = CloudConfigurationManager.GetSetting("Microsoft.DocumentDB.SkuVariantMap.DBCollectionName");
            var docDbEndpointName = CloudConfigurationManager.GetSetting("Microsoft.DocumentDB.StockQuantity.EUN.AccountEndpoint");
            var docDbEndpointKey  = CloudConfigurationManager.GetSetting("Microsoft.DocumentDB.StockQuantity.EUN.AccountKey");

            _skuVariantMapBatchSize = Convert.ToInt16(CloudConfigurationManager.GetSetting("SkuVariantMapBatchSize"));

            _topicClient = TopicClient.CreateFromConnectionString(sqServiceBusConnectionString);

            _stockQuantityAggregateStore = new RegionStockAggregateDocumentStore(docDbName, docDbsqColName, docDbsvColName, docDbEndpointName, docDbEndpointKey, _connectionPolicy);

            InitialiseSkuVariantMapCacheManager();

            CreateServiceBusMessagingEntities();

            return(base.OnStart());
        }
示例#2
0
        public VariantCopyCompletedV1Handler(IRegionStockAggregateStore regionStockAggregateStore, TelemetryClient telemetryClient)
        {
            if (regionStockAggregateStore == null)
            {
                throw new ArgumentNullException();
            }

            _telemetryClient           = telemetryClient;
            _regionStockAggregateStore = regionStockAggregateStore;
        }
示例#3
0
        public RestrictionAttributesAcceptedV1Handler(IRegionStockAggregateStore regionStockAggregateStore, SkuVariantCacheManager skuVariantCacheManager, TelemetryClient telemetryClient)
        {
            if (regionStockAggregateStore == null)
            {
                throw new ArgumentNullException();
            }

            _telemetryClient           = telemetryClient;
            _regionStockAggregateStore = regionStockAggregateStore;
            _skuVariantCacheManager    = skuVariantCacheManager;
        }
示例#4
0
 protected MessageReceiver(int maximumConcurrency, string wasServiceBusConnectionString, string wasSubscriptionName, string wasTopicPath, TopicClient stockQuantityTopicClient, IRegionStockAggregateStore stockQuantityAggregateStore, SkuVariantCacheManager skuVariantCacheManager, TelemetryClient telemetryClient)
 {
     SkuVariantCacheManager        = skuVariantCacheManager;
     MaximumConcurrency            = maximumConcurrency;
     WasServiceBusConnectionString = wasServiceBusConnectionString;
     WasSubscriptionName           = wasSubscriptionName;
     WasTopicPath                = wasTopicPath;
     StockQuantityTopicClient    = stockQuantityTopicClient;
     StockQuantityAggregateStore = stockQuantityAggregateStore;
     TelemetryClient             = telemetryClient;
 }
示例#5
0
        public WarehouseAvailableStockChangedV1Handler(TopicClient stockQuantityTopicClient, IRegionStockAggregateStore regionStockAggregateStore, SkuVariantCacheManager skuVariantCacheManager, TelemetryClient telemetryClient)
        {
            if (stockQuantityTopicClient == null)
            {
                throw new ArgumentNullException();
            }

            if (regionStockAggregateStore == null)
            {
                throw new ArgumentNullException();
            }

            _telemetryClient           = telemetryClient;
            _stockQuantityTopicClient  = stockQuantityTopicClient;
            _skuVariantCacheManager    = skuVariantCacheManager;
            _regionStockAggregateStore = regionStockAggregateStore;
        }
        public WarehouseAvailableStockChangedPublisher(TopicClient warehouseAvailableStockTopicClient, IRegionStockAggregateStore stockQuantityStore, int skuVariantBatchSize, int publishBatchSize, TelemetryClient telemetryClient)
        {
            if (warehouseAvailableStockTopicClient == null)
            {
                throw new ArgumentNullException();
            }

            if (stockQuantityStore == null)
            {
                throw new ArgumentNullException();
            }

            if (warehouseAvailableStockTopicClient == null)
            {
                throw new ArgumentNullException();
            }
            _warehouseAvailableStockTopicClient = warehouseAvailableStockTopicClient;
            _stockQuantityStore  = stockQuantityStore;
            _skuVariantBatchSize = skuVariantBatchSize;
            _publishBatchSize    = publishBatchSize;
            _telemetryClient     = telemetryClient;
        }
 public RestrictionAttributesAcceptedReceiver(int maximumConcurrency, string wasServiceBusConnectionString, string wasSubscriptionName, string wasTopicPath, TopicClient stockQuantityTopicClient, IRegionStockAggregateStore stockQuantityAggregateStore, SkuVariantCacheManager skuVariantCacheManager, TelemetryClient telemetryClient)
     : base(maximumConcurrency, wasServiceBusConnectionString, wasSubscriptionName, wasTopicPath, stockQuantityTopicClient, stockQuantityAggregateStore, skuVariantCacheManager, telemetryClient)
 {
 }