private void RecoverDelayedMessages(QueueManager queueManager) { queueManager.GetQueue(LightningQueuesTransport.DelayedQueueName) .GetAllMessages(null) .Each(x => _delayedMessages.Add(x.Id, x.ExecutionTime())); }
public MessageAcceptance(QueueManager parent, IList<MessageBookmark> bookmarks, IEnumerable<Message> messages, QueueStorage queueStorage) { _parent = parent; _bookmarks = bookmarks; _messages = messages; _queueStorage = queueStorage; Interlocked.Increment(ref parent._currentlyInCriticalReceiveStatus); }
public IEnumerable<EnvelopeToken> ReplayDelayed(QueueManager queueManager, DateTime currentTime) { var list = new List<EnvelopeToken>(); var transactionalScope = queueManager.BeginTransactionalScope(); try { var readyToSend = _delayedMessages.AllMessagesBefore(currentTime); readyToSend.Each(x => { var message = transactionalScope.ReceiveById(LightningQueuesTransport.DelayedQueueName, x); var uri = message.Headers[Envelope.ReceivedAtKey].ToLightningUri(); transactionalScope.EnqueueDirectlyTo(uri.QueueName, message.ToPayload()); list.Add(message.ToToken()); }); transactionalScope.Commit(); } catch (Exception e) { transactionalScope.Rollback(); _logger.Error("Error trying to move delayed messages back to the original queue", e); } return list; }