Example #1
0
        public BillingManager(
            ServiceConfiguration configuration,
            IReliableStateManager stateManager)
            : base(TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(10), TimeSpan.FromMinutes(5), 100, 10)
        {
            var storageClient = new StorageClient(configuration.StoreAccountConnectionString);

            this.table = storageClient.GetTable(configuration.UsageReportingTableName);
            this.queue = storageClient.GetQueue(configuration.UsageReportingQueueName);

            this.pushUsageForWhitelistedSubscriptionsOnly = configuration.PushUsageForWhitelistedSubscriptionsOnly;
            this.whitelistedSubscriptionIds = configuration.WhitelistedSubscriptions;
            this.stateManager = stateManager;

            this.buckets         = new Dictionary <string, BillingUsageBucket>();
            this.bucketStateLock = new ReaderWriterLockSlim();

            this.lastHeartBeat = DateTime.MinValue;
        }