Exemple #1
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);
 }
Exemple #2
0
        internal void OnDispatcherDiscardedRejection(Message message, Message.RejectionTypes rejectionType, string reason, Exception exception)
        {
            if (this.IsEnabled(DispatcherDiscardedRejectionEventName))
            {
                this.Write(DispatcherDiscardedRejectionEventName, new { Message = message, RejectionType = rejectionType, Reason = reason, Exception = exception });
            }

            LogDispatcherDiscardedRejection(this, message, reason, rejectionType, exception);
        }
Exemple #3
0
        internal void SendRejection(Message msg, Message.RejectionTypes rejectionType, string reason)
        {
            MessagingStatisticsGroup.OnRejectedMessage(msg);
            if (string.IsNullOrEmpty(reason))
            {
                reason = string.Format("Rejection from silo - Unknown reason.");
            }
            var error = this.messageFactory.CreateRejectionResponse(msg, rejectionType, reason);

            // rejection msgs are always originated locally, they are never remote.
            this.OnReceivedMessage(error);
        }
Exemple #4
0
        public Message CreateRejectionResponse(Message request, Message.RejectionTypes type, string info, Exception ex = null)
        {
            var response = this.CreateResponseMessage(request);

            response.Result        = Message.ResponseTypes.Rejection;
            response.RejectionType = type;
            response.RejectionInfo = info;
            response.BodyObject    = ex;
            if (this.logger.IsEnabled(LogLevel.Debug))
            {
                this.logger.Debug("Creating {0} rejection with info '{1}' for {2} at:" + Environment.NewLine + "{3}", type, info, this, Utils.GetStackTrace());
            }
            return(response);
        }
Exemple #5
0
        internal void OnDispatcherRejectMessage(Message message, Message.RejectionTypes rejectionType, string reason, Exception exception)
        {
            if (this.IsEnabled(DispatcherRejectedMessageEventName))
            {
                this.Write(DispatcherRejectedMessageEventName, new { Message = message, RejectionType = rejectionType, Reason = reason, Exception = exception });
            }

            MessagingStatisticsGroup.OnRejectedMessage(message);

            if (this.IsEnabled(LogLevel.Debug))
            {
                LogDispatcherRejectedMessage(this, message, reason, rejectionType, exception);
            }
        }
Exemple #6
0
        public void RejectMessage(
            Message message,
            Message.RejectionTypes rejectionType,
            Exception exc,
            string rejectInfo = null)
        {
            if (message.Direction == Message.Directions.Request ||
                (message.Direction == Message.Directions.OneWay && message.HasCacheInvalidationHeader))
            {
                this.messagingTrace.OnDispatcherRejectMessage(message, rejectionType, rejectInfo, exc);

                var     str       = string.Format("{0} {1}", rejectInfo ?? "", exc == null ? "" : exc.ToString());
                Message rejection = this.messageFactory.CreateRejectionResponse(message, rejectionType, str, exc);
                SendRejectionMessage(rejection);
            }
            else
            {
                this.messagingTrace.OnDispatcherDiscardedRejection(message, rejectionType, rejectInfo, exc);
            }
        }
Exemple #7
0
 public void RejectMessage(
     Message message,
     Message.RejectionTypes rejectType,
     Exception exc,
     string rejectInfo = null)
 {
     if (message.Direction == Message.Directions.Request)
     {
         var str = String.Format("{0} {1}", rejectInfo ?? "", exc == null ? "" : exc.ToString());
         MessagingStatisticsGroup.OnRejectedMessage(message);
         Message rejection = message.CreateRejectionResponse(rejectType, str);
         SendRejectionMessage(rejection);
     }
     else
     {
         logger.Warn(ErrorCode.Messaging_Dispatcher_DiscardRejection,
                     "Discarding {0} rejection for message {1}. Exc = {2}",
                     Enum.GetName(typeof(Message.Directions), message.Direction), message, exc.Message);
     }
 }
 public ServiceRejectionException(Message.RejectionTypes rejectionType)
 {
     RejectionType = rejectionType;
 }
 public ServiceRejectionException(Message.RejectionTypes rejectionType, Exception innerException)
     : base(rejectionType.ToString(), innerException)
 {
     RejectionType = rejectionType;
 }