protected override void Context()
        {
            dispatcher.Setup(x => x.Dispatch(commit));
            persistence.Setup(x => x.MarkCommitAsDispatched(commit));

            dispatchScheduler = new AsynchronousDispatchScheduler(dispatcher.Object, persistence.Object);
        }
Beispiel #2
0
        public AsynchronousDispatchSchedulerWireup(Wireup wireup, IDispatchCommits dispatcher, DispatcherSchedulerStartup startup)
            : base(wireup)
        {
            var option = Container.Resolve <TransactionScopeOption>();

            if (option != TransactionScopeOption.Suppress)
            {
                Logger.Warn(Messages.SynchronousDispatcherTwoPhaseCommits);
            }

            Logger.Debug(Messages.AsyncDispatchSchedulerRegistered);
            Startup(startup);
            DispatchTo(dispatcher ?? new NullDispatcher());
            Container.Register <IScheduleDispatches>(c =>
            {
                var dispatchScheduler = new AsynchronousDispatchScheduler(
                    c.Resolve <IDispatchCommits>(),
                    c.Resolve <IPersistStreams>());
                if (c.Resolve <DispatcherSchedulerStartup>() == DispatcherSchedulerStartup.Auto)
                {
                    dispatchScheduler.Start();
                }
                return(dispatchScheduler);
            });
        }
        public EventSource UsingAsynchronousDispatchScheduler(IDispatchCommits instance)
        {
            var dispatcher = new AsynchronousDispatchScheduler(instance, _store);

            _pipelineHooks.Add(new DispatchSchedulerPipelineHook(dispatcher));
            _hasDispatcher = true;
            return(this);
        }
 protected override void Context()
 {
     _dispatchScheduler = new AsynchronousDispatchScheduler(dispatcher, persistence);
     _dispatchScheduler.Start();
 }