Ejemplo n.º 1
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);
     }
 }
Ejemplo n.º 2
0
        private void RejectMessage(Message msg, string reasonFormat, params object[] reasonParams)
        {
            if (!Running) return;

            var reason = String.Format(reasonFormat, reasonParams);
            if (msg.Direction != Message.Directions.Request)
            {
                if (logger.IsVerbose) logger.Verbose(ErrorCode.ProxyClient_DroppingMsg, "Dropping message: {0}. Reason = {1}", msg, reason);
            }
            else
            {
                if (logger.IsVerbose) logger.Verbose(ErrorCode.ProxyClient_RejectingMsg, "Rejecting message: {0}. Reason = {1}", msg, reason);
                MessagingStatisticsGroup.OnRejectedMessage(msg);
                Message error = msg.CreateRejectionResponse(Message.RejectionTypes.Unrecoverable, reason);
                QueueIncomingMessage(error);
            }
        }
Ejemplo n.º 3
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 == null ? "" : exc.Message);
     }
 }
Ejemplo n.º 4
0
 protected override void FailMessage(Message msg, string reason)
 {
     msg.ReleaseBodyAndHeaderBuffers();
     MessagingStatisticsGroup.OnFailedSentMessage(msg);
     if (MsgCenter.Running && msg.Direction == Message.Directions.Request)
     {
         if (Log.IsVerbose) Log.Verbose(ErrorCode.ProxyClient_RejectingMsg, "Rejecting message: {0}. Reason = {1}", msg, reason);
         MessagingStatisticsGroup.OnRejectedMessage(msg);
         Message error = msg.CreateRejectionResponse(Message.RejectionTypes.Unrecoverable, reason);
         MsgCenter.QueueIncomingMessage(error);
     }
     else
     {
         Log.Warn(ErrorCode.ProxyClient_DroppingMsg, "Dropping message: {0}. Reason = {1}", msg, reason);
         MessagingStatisticsGroup.OnDroppedSentMessage(msg);
     }
 }