Ejemplo n.º 1
0
        /// <summary>
        /// Odesle postupne vsechny notifikace co jsou ve fronte.
        /// </summary>
        /// <returns></returns>
        public async Task SendAllNotifications()
        {
            NotifyItem notifyItem = await queue.PopAsync <NotifyItem>(QueueType.Notification);

            while (notifyItem != null)
            {
                switch (notifyItem.ChannelType)
                {
                case ChannelType.Email:
                    await emailNotificator.SendEmailAsync(notifyItem.Contact, notifyItem.Subject, notifyItem.Message);

                    break;

                default:
                    logger.LogError($"Notificaiton sending for '{notifyItem.ChannelType}' not implemented yet.");
                    break;
                }

                notifyItem = await queue.PopAsync <NotifyItem>(QueueType.Notification);
            }
        }