Ejemplo n.º 1
0
        public static async Task AddToPendingSubscriptionQueueAsync(OneDriveNotification notification)
        {
            QueryStringBuilder qsb = new QueryStringBuilder {
                StartCharacter = null
            };

            qsb.Add("id", notification.UserId);

            CloudQueueMessage message = new CloudQueueMessage(qsb.ToString());
            await SubscriptionQueue.AddMessageAsync(message);
        }
Ejemplo n.º 2
0
        public static async Task <int> GetPendingSubscriptionQueueDepthAsync()
        {
            await SubscriptionQueue.FetchAttributesAsync();

            int?cachedMessageCount = SubscriptionQueue.ApproximateMessageCount;

            if (cachedMessageCount.HasValue)
            {
                return(cachedMessageCount.Value);
            }
            else
            {
                return(-1);
            }
        }
Ejemplo n.º 3
0
        public static void InitializeConnections()
        {
            string connectionString = SharedConfig.AzureStorageConnectionString;

            AzureStorage.StorageAccount = CloudStorageAccount.Parse(connectionString);

            CloudTableClient tableClient = StorageAccount.CreateCloudTableClient();

            AccountTable = tableClient.GetTableReference("account");
            AccountTable.CreateIfNotExists();

            ActivityTable = tableClient.GetTableReference("activity");
            ActivityTable.CreateIfNotExists();

            CloudQueueClient queueClient = StorageAccount.CreateCloudQueueClient();

            SubscriptionQueue = queueClient.GetQueueReference("subscriptions");
            SubscriptionQueue.CreateIfNotExists();
        }