Beispiel #1
0
        protected bool RemoveIfDelivered(ProdigyMessage message)
        {
            if (message.IsDelivered)
            {
                _messageQueue.Remove(message);
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        protected void Invoke(ProdigyMessage message)
        {
            EventHandler <EventArgs> targetEvent;

            bool eventTableContainsId = _eventTable.TryGetValue(message.Id, out targetEvent);

            if (eventTableContainsId)
            {
                // Take a local copy to prevent a race condition if another thread
                // were to unsubscribe from this event.
                var callback = targetEvent;

                if (callback != null)
                {
                    callback(message.Sender, message.Data);
                }
            }
        }
Beispiel #3
0
 public void SendMessage(ProdigyMessage newMessage)
 {
     _messageIncomingQueue.Add(newMessage);
 }