public bool TrySendLocal(Message message)
        {
            if (!message.TargetSilo.Equals(MyAddress))
            {
                return(false);
            }

            if (log.IsEnabled(LogLevel.Trace))
            {
                log.Trace("Message has been looped back to this silo: {0}", message);
            }
            MessagingStatisticsGroup.LocalMessagesSent.Increment();
            var localHandler = localMessageHandlers[(int)message.Category];

            if (localHandler != null)
            {
                localHandler(message);
            }
            else
            {
                InboundQueue.PostMessage(message);
            }

            return(true);
        }
Example #2
0
 internal void SendRejection(Message msg, Message.RejectionTypes rejectionType, string reason)
 {
     MessagingStatisticsGroup.OnRejectedMessage(msg);
     if (string.IsNullOrEmpty(reason)) reason = string.Format("Rejection from silo {0} - Unknown reason.", MyAddress);
     Message error = this.messageFactory.CreateRejectionResponse(msg, rejectionType, reason);
     // rejection msgs are always originated in the local silo, they are never remote.
     InboundQueue.PostMessage(error);
 }