コード例 #1
0
        public Task ProcessMonitorMessage(SlackNotificationRequestMsg msg)
        {
            _msgForwarder.ForwardMsgAsync(msg.ToJson()); //temporary added until logs will not be using pub/sub. Forwarded message will be analyzed by another job

            return(ProcessMessageFromQueue(msg, "slack-notifications-monitor"));
        }
コード例 #2
0
        public async Task ProcessInMessage(SlackNotificationRequestMsg msg)
        {
            try
            {
                await _srvSlackNotifications.SendNotification(msg.Type, msg.Message, msg.Sender);
            }
            catch (Exception ex)
            {
                await _log.WriteErrorAsync("SlackNotificationRequestsConsumer", "ProcessInMessage", msg.ToJson(), ex);

                throw;
            }
        }
コード例 #3
0
        public async Task <MuteItem> GetMutedItem(SlackNotificationRequestMsg message)
        {
            string key = _mutedSenders.Keys.FirstOrDefault(item => message.Sender.IndexOf(item, StringComparison.OrdinalIgnoreCase) >= 0);

            if (!string.IsNullOrEmpty(key))
            {
                return(_mutedSenders[key]);
            }

            key = _mutedSenders.Keys.FirstOrDefault(item => message.Message.StartsWith(item));

            if (!string.IsNullOrEmpty(key))
            {
                await _log.WriteInfoAsync(nameof(NotificationFilter), nameof(GetMutedItem), message.ToJson(), "Sender set in the Message property");

                return(_mutedSenders[key]);
            }

            key = _mutedPrefixes.Keys.FirstOrDefault(item => message.Message.StartsWith(item));

            if (!string.IsNullOrEmpty(key))
            {
                return(_mutedPrefixes[key]);
            }

            key = _mutedMessagesRegex.Keys.FirstOrDefault(item => Regex.IsMatch(message.Message, item));

            if (!string.IsNullOrEmpty(key))
            {
                return(_mutedMessagesRegex[key]);
            }

            return(null);
        }