Example #1
0
 public bool TryMoveMessage(OpenedQueue queue, Message message, SubQueue subQueue, out string msgId)
 {
     using (var destinationQueue = queue.OpenSiblngQueue(subQueue, QueueAccessMode.Send))
     {
         Message receiveById;
         try
         {
             receiveById = queue.ReceiveById(message.Id);
         }
         catch (InvalidOperationException)
         {
             msgId = null;
             return(false);
         }
         receiveById.AppSpecific = 0;//reset flag
         destinationQueue.Send(receiveById);
         msgId = receiveById.Id;
         logger.DebugFormat("Moving messgage {0} from {1} to {2}, new id: {3}",
                            message.Id,
                            queue.RootUri,
                            destinationQueue.QueueUrl,
                            receiveById.Id);
         return(true);
     }
 }
Example #2
0
        /// <summary>
        /// Gets a listing of all timeout messages.
        /// </summary>
        /// <returns></returns>
        public IEnumerable<TimeoutInfo> GetTimeoutMessages(OpenedQueue queue)
        {
            using (var timeoutQueue = queue.OpenSiblngQueue(SubQueue.Timeout, QueueAccessMode.Receive))
            {
                var enumerator2 = timeoutQueue.GetMessageEnumerator2();
                while (enumerator2.MoveNext())
                {
                    var message = enumerator2.Current;
                    if (message == null)
                        continue;

                    yield return new TimeoutInfo
                                 	{
                                 		Id = message.Id,
                                 		Time = DateTime.FromBinary(BitConverter.ToInt64(message.Extension, 0))
                                 	};
                }
            }
        }
Example #3
0
        /// <summary>
        /// Gets a listing of all timeout messages.
        /// </summary>
        /// <returns></returns>
        public IEnumerable <TimeoutInfo> GetTimeoutMessages(OpenedQueue queue)
        {
            using (var timeoutQueue = queue.OpenSiblngQueue(SubQueue.Timeout, QueueAccessMode.Receive))
            {
                var enumerator2 = timeoutQueue.GetMessageEnumerator2();
                while (enumerator2.MoveNext())
                {
                    var message = enumerator2.Current;
                    if (message == null || message.Extension.Length < 16)
                    {
                        continue;
                    }

                    yield return(new TimeoutInfo
                    {
                        Id = message.Id,
                        Time = DateTime.FromBinary(BitConverter.ToInt64(message.Extension, 16))
                    });
                }
            }
        }
 public bool TryMoveMessage(OpenedQueue queue, Message message, SubQueue subQueue, out string msgId)
 {
     using (var destinationQueue = queue.OpenSiblngQueue(subQueue, QueueAccessMode.Send))
     {
         Message receiveById;
         try
         {
             receiveById = queue.ReceiveById(message.Id);
         }
         catch (InvalidOperationException)
         {
             msgId = null;
             return false;
         }
         receiveById.AppSpecific = 0;//reset flag
         destinationQueue.Send(receiveById);
         msgId = receiveById.Id;
         logger.DebugFormat("Moving messgage {0} from {1} to {2}, new id: {3}",
             message.Id,
             queue.RootUri,
             destinationQueue.QueueUrl,
             receiveById.Id);
         return true;
     }
 }
 public OpenedQueue OpenSubQueue(OpenedQueue queue, SubQueue subQueue, QueueAccessMode accessMode)
 {
     return queue.OpenSiblngQueue(subQueue, accessMode);
 }
Example #6
0
 public OpenedQueue OpenSubQueue(OpenedQueue queue, SubQueue subQueue, QueueAccessMode accessMode)
 {
     return(queue.OpenSiblngQueue(subQueue, accessMode));
 }