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")); }
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; } }
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); }