public override bool Requeue(T item, bool highPriority)
 {
     if (highPriority)
     {
         return(base.Requeue(item, highPriority));
     }
     else
     {
         try
         {
             _lowPriorityQueue.Enqueue(item);
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
Пример #2
0
        /// <summary>
        /// 入队列
        /// </summary>
        /// <param name="queueName">队列名称</param>
        /// <param name="rabbitsConfigKey">RabbitMQ配置Key(为空默认第一个配置Key)</param>
        /// <param name="value"></param>
        public static bool Enqueue(string queueName, string[] values, string rabbitsConfigKey = "")
        {
            Check.Argument.IsNotEmpty(queueName, "队列名称");
            List <string> clears = new List <string>();

            values.Each(t =>
            {
                if (!string.IsNullOrWhiteSpace(t))
                {
                    clears.Add(t);
                }
            });
            if (clears.Count > 0)
            {
                Log.Info(string.Format("Enqueue:{0}", clears.Count));
                return(_queue.Enqueue(queueName, clears.ToArray(), rabbitsConfigKey));
            }
            else
            {
                return(true);
            }
        }