Beispiel #1
0
        private async Task Execute(string fulfillerId)
        {
            // read all notifications
            logger.LogInformation("Querying FOMA for notifications");
            var notificationResult = await fomaSdk.GetNotifications(fulfillerId);

            logger.LogInformation($"Found {notificationResult.Count.GetValueOrDefault()} notifications.");

            // loop through all notifications
            foreach (var notification in notificationResult.Notifications)
            {
                logger.LogInformation($"Found notification {notification.NotificationId} of type {notification.Type}.");
                if (notification.Type == "OrderRequest")
                {
                    try
                    {
                        await ImportOrder(notification);
                        await AcceptNotification(notification);
                    }
                    catch (Exception ex)
                    {
                        logger.LogError(ex, "Error while importing order for notification {NotificationId}", notification.NotificationId);
                    }
                }
            }
        }