示例#1
0
        public static int GetAttemptCount(this BasicDeliverEventArgs message)
        {
            message.EnsureMessage();

            if (message.BasicProperties.Headers.ContainsKey(AttemptCountHeader))
            {
                return((int)message.BasicProperties.Headers[AttemptCountHeader]);
            }

            return(0);
        }
示例#2
0
        public static void SetHeader <T>(this BasicDeliverEventArgs message, string key, T value)
        {
            message.EnsureMessage();

            if (Equals(value, default(T)))
            {
                message.BasicProperties.Headers.Remove(key);
            }
            else
            {
                message.BasicProperties.Headers[key] = value;
            }
        }
示例#3
0
 public static object GetHeader(this BasicDeliverEventArgs message, string key)
 {
     message.EnsureMessage();
     return(message.BasicProperties.Headers.ContainsKey(key) ? message.BasicProperties.Headers[key] : null);
 }
示例#4
0
 public static void SetAttemptCount(this BasicDeliverEventArgs message, int count)
 {
     message.EnsureMessage();
     message.SetHeader(AttemptCountHeader, count);
 }