コード例 #1
0
        private static async Task ProcessMsgAsync(Message message, CancellationToken cancellationToken)
        {
            var id = Encoding.UTF8.GetString(message.Body);

            var recipe = await CookingService.GetRecipeDetailsAsync(id, HttpClient, RecipeDetailsUrl);

            await DocumentClient.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(DatabaseId, CollectionName), recipe, cancellationToken : cancellationToken);
        }
コード例 #2
0
        private void PrepareOrder(Order order)
        {
            var cooker = new CookingService();

            foreach (var item in order.Items)
            {
                item.MenuItem = cooker.Prepare(item.ItemId);
            }
        }
コード例 #3
0
        private void PrepareOrder(Order order)
        {
            var cooker = new CookingService();

            foreach (var item in order.Items)
            {
                cooker.Prepare(item.ItemId, item.Quantity);
            }
        }
コード例 #4
0
        static async Task DumpRecipeIdsAsync()
        {
            var queueClient = new QueueClient(QueueConnectionString, QueueName);

            // todo fetch page count
            for (int page = 1; page <= 25; page++)
            {
                var ids = await CookingService.GetRecipesIdsAsync(page, HttpClient, RecipesUrl);

                var msgs = ids.Select(x => new Message(Encoding.UTF8.GetBytes(x))).ToList();

                await queueClient.SendAsync(msgs);
            }

            await queueClient.CloseAsync();
        }