public void Run() { if (TimeoutManager == null) { return; } TimeoutManager.SagaTimedOut += (o, e) => { using (var scope = new TransactionScope(TransactionScopeOption.Required)) { MessageSender.Send(MapToTransportMessage(e), e.Destination); Persister.Remove(e.SagaId); scope.Complete(); } }; Persister.GetAll().ToList().ForEach(td => TimeoutManager.PushTimeout(td)); thread = new Thread(Poll); thread.Start(); }
void CacheExistingTimeouts() { var sw = new Stopwatch(); sw.Start(); Logger.DebugFormat("Going to fetch existing timeouts from persister ({0})", Persister.GetType().Name); var existingTimeouts = Persister.GetAll().ToList(); Logger.DebugFormat("{0} timeouts loaded from storage in {1} seconds", existingTimeouts.Count, sw.Elapsed.TotalSeconds); existingTimeouts.ForEach(td => TimeoutManager.PushTimeout(td)); sw.Stop(); Logger.DebugFormat("Total time for cache priming {0} seconds", sw.Elapsed.TotalSeconds); }
public void Run() { Manager.SagaTimedOut += (o, e) => { if (!I.CanSend(e)) { return; } Bus.Send(e.Destination, new TimeoutMessage { SagaId = e.SagaId, Expires = e.Time, State = e.State }); Persister.Remove(e.SagaId); }; Persister.GetAll().ToList().ForEach(td => Manager.PushTimeout(td)); thread = new Thread(Poll); thread.Start(); }
public void Run() { Manager.SagaTimedOut += (o, e) => { using (var scope = new TransactionScope(TransactionScopeOption.Required)) { Bus.Send(e.Destination, new TimeoutMessage { SagaId = e.SagaId, Expires = e.Time, State = e.State }); Persister.Remove(e.SagaId); scope.Complete(); } }; Persister.GetAll().ToList().ForEach(td => Manager.PushTimeout(td)); thread = new Thread(Poll); thread.Start(); }