protected override bool InternalExecute(ProcessExecutingContext context) { MsgChannelManager channelManager = MsgChannelManager.Instance; if (!SendForAll) { List <Guid> targetIds = UserConnection.SessionData[TargetUserIdsKey] as List <Guid>; if (targetIds != null) { foreach (Guid id in targetIds) { IMsgChannel userChannel = channelManager.FindItemByUId(id); PostMsgText(userChannel); } } } else { foreach (IMsgChannel userChannel in channelManager.Channels.Values) { PostMsgText(userChannel); } } return(true); }
public static void PostMessageToAll(string senderName, string messageText) { if (!CheckCanPostMessage(null, senderName)) { return; } MsgChannelManager channelManager = MsgChannelManager.Instance; foreach (IMsgChannel userChannel in channelManager.Channels.Values) { PostMessageInternal(userChannel, senderName, messageText); } }
public static void PostMessage(UserConnection userConnection, string senderName, string messageText) { if (!CheckCanPostMessage(userConnection.CurrentUser.Name, senderName)) { return; } MsgChannelManager channelManager = MsgChannelManager.Instance; IMsgChannel userChannel = channelManager.FindItemByUId(userConnection.CurrentUser.Id); if (userChannel != null) { PostMessageInternal(userChannel, senderName, messageText); } else { _log.Info(string.Format("Channel not found for user {0} from {1}", userConnection.CurrentUser.Name, senderName)); } }
/// <summary> /// ########## ######### ###########. /// </summary> /// <param name="type">### #########.</param> /// <param name="message">#########.</param> private static void NotifySubscribers(string type, string message) { try { foreach (Guid subscriberId in QueuesNotificationsSubscribers) { MsgChannelManager manager = MsgChannelManager.Instance; IMsgChannel channel = manager.FindItemByUId(subscriberId); if (channel == null) { continue; } var simpleMessage = new SimpleMessage(); simpleMessage.Body = message; simpleMessage.Id = channel.Id; simpleMessage.Header.BodyTypeName = type; simpleMessage.Header.Sender = "QueuesNotification"; channel.PostMessage(simpleMessage); } } catch (Exception e) { _log.ErrorFormat(message, e.Message, e); } }
public WebSocketNotificationHandler(UserConnection userConnection, IDictionary <string, object> parameters) : base(userConnection, parameters) { _channelManager = MsgChannelManager.Instance; }
public WebSocketNotificationSender(UserConnection userConnection, string bodyTypeName) { _userConnection = userConnection; _channelManager = MsgChannelManager.Instance; _bodyTypeName = bodyTypeName; }