예제 #1
0
        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();
        }
예제 #2
0
        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);
        }
예제 #3
0
        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();
        }
예제 #4
0
        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();
        }