public void SendReply(string recipient, TimeoutReply reply, Guid sagaId) { if (sagaId != Guid.Empty) { bus.AttachHeader(reply, Headers.AutoCorrelationSagaId, sagaId.ToString()); } bus.Advanced.Routing.Send(recipient, reply); }
void SendReply(DueTimeout timeout, TimeoutReply reply) { try { handleDeferredMessage.SendReply(timeout.ReplyTo, reply, timeout.SagaId); } catch (Exception exception) { throw new ApplicationException(string.Format("An error occurred while attempting to send reply for {0}", timeout), exception); } }
void CheckCallbacks(object sender, ElapsedEventArgs e) { if (currentlyChecking) { return; } lock (checkLock) { if (currentlyChecking) { return; } try { currentlyChecking = true; var dueTimeouts = storeTimeouts.GetDueTimeouts().ToList(); if (!dueTimeouts.Any()) { return; } log.Info("Got {0} dues timeouts - will send them now", dueTimeouts.Count); foreach (var timeout in dueTimeouts) { log.Info("Timeout!: {0} -> {1}", timeout.CorrelationId, timeout.ReplyTo); var sagaId = timeout.SagaId; var reply = new TimeoutReply { SagaId = sagaId, CorrelationId = timeout.CorrelationId, DueTime = timeout.TimeToReturn, CustomData = timeout.CustomData, }; handleDeferredMessage.SendReply(timeout.ReplyTo, reply, sagaId); timeout.MarkAsProcessed(); } } finally { currentlyChecking = false; } } }
public void SendReply(string recipient, TimeoutReply reply, Guid sagaId) { }
void CheckCallbacks(object sender, ElapsedEventArgs e) { if (currentlyChecking) { return; } lock (checkLock) { if (currentlyChecking) { return; } try { currentlyChecking = true; using (var dueTimeoutsResult = GetDueTimeouts()) { var dueTimeouts = dueTimeoutsResult.DueTimeouts.ToList(); if (!dueTimeouts.Any()) { return; } log.Info("Got {0} dues timeouts - will send them now", dueTimeouts.Count); foreach (var timeout in dueTimeouts) { log.Info("Timeout!: {0} -> {1}", timeout.CorrelationId, timeout.ReplyTo); var reply = new TimeoutReply { SagaId = timeout.SagaId, CorrelationId = timeout.CorrelationId, DueTime = timeout.TimeToReturn, CustomData = timeout.CustomData, }; SendReply(timeout, reply); MarkAsProcessed(timeout); } } lastSuccess = DateTime.UtcNow; } catch (Exception exception) { var timeSinceLastSuccess = DateTime.UtcNow - lastSuccess; if (timeSinceLastSuccess > MaxAcceptedFailureTimeBeforeLogLevelEscalation) { log.Error(exception, "An error occurred while attempting to retrieve due timeouts and send timeout replies! The situation has been going on for {0}", timeSinceLastSuccess); } else { log.Warn( "An error occurred while attempting to retrieve due timeouts and send timeout replies: {0} - if the situation persists for more than {1}, the log level will escalate from WARN to ERROR", exception, MaxAcceptedFailureTimeBeforeLogLevelEscalation); } } finally { currentlyChecking = false; } } }