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; } } }