/// <summary> /// Send a message to a particular recipient. /// </summary> public void SendMessage(NotificationMessage message) { if (recipients.ContainsKey(message.RecipientName)) { NotificationClient client = recipients[message.RecipientName]; client.EnqueueMessage(message); } }
/// <summary> /// Called by a individual recipient to wait and receive a message. /// </summary> /// <returns>The message content</returns> public string GetMessage(string userName) { string messageContent = string.Empty; if (recipients.ContainsKey(userName)) { NotificationClient client = recipients[userName]; messageContent = client.DequeueMessage().MessageContent; } return(messageContent); }
/// <summary> /// Join a user to the recipient list. /// </summary> public void Join(string userName) { recipients[userName] = new NotificationClient(); }