Example #1
0
        public NESWireup(Wireup wireup)
            : base(wireup)
        {
            var serializer = Container.Resolve <ISerialize>();

            if (serializer != null)
            {
                Logger.Debug("Configuring custom NES serializer to cope with payloads that contain messages as interfaces.");
                Logger.Debug("Wrapping serializer of type '{0}' in '{1}'", serializer.GetType(), typeof(CompositeSerializer));

                this.Container.Register <ISerialize>(new CompositeSerializer(serializer, () => DI.Current.Resolve <IEventSerializer>()));
            }

            Logger.Debug("Configuring the store to dispatch messages synchronously.");
            Logger.Debug("Registering dispatcher of type '{0}'.", typeof(MessageDispatcher));

            this.Container.Register <IDispatchCommits>(new MessageDispatcher(() => DI.Current.Resolve <IEventPublisher>()));
            this.Container.Register <IScheduleDispatches>(c =>
            {
                var dispatchScheduler = new SynchronousDispatchScheduler(
                    c.Resolve <IDispatchCommits>(),
                    c.Resolve <IPersistStreams>());
                if (c.Resolve <DispatcherSchedulerStartup>() == DispatcherSchedulerStartup.Auto)
                {
                    dispatchScheduler.Start();
                }

                return(dispatchScheduler);
            });

            DI.Current.Register <IEventStore, IStoreEvents>(eventStore => new EventStoreAdapter(eventStore));
        }
        protected override void Context()
        {
            dispatcher.Setup(x => x.Dispatch(commit));
            persistence.Setup(x => x.MarkCommitAsDispatched(commit));

            dispatchScheduler = new SynchronousDispatchScheduler(dispatcher.Object, persistence.Object);
        }
Example #3
0
        protected override void Context()
        {
            _dispatcher.Setup(x => x.Dispatch(_commitAttempt));
            _persistence.Setup(x => x.MarkCommitAsDispatched(_commitAttempt));

            _dispatchScheduler = new SynchronousDispatchScheduler(_dispatcher.Object, _persistence.Object);
        }
        public EventSource UsingSynchronousDispatchScheduler(IDispatchCommits instance)
        {
            var dispatcher = new SynchronousDispatchScheduler(instance, _store);

            _pipelineHooks.Add(new DispatchSchedulerPipelineHook(dispatcher));
            _hasDispatcher = true;
            return(this);
        }
 public SynchronousDispatchSchedulerWireup(Wireup wireup, IDispatchCommits dispatcher, DispatcherSchedulerStartup startup)
     : base(wireup)
 {
     Logger.Debug(Messages.SyncDispatchSchedulerRegistered);
     Startup(startup);
     DispatchTo(dispatcher ?? new NullDispatcher());
     Container.Register <IScheduleDispatches>(c =>
     {
         var dispatchScheduler = new SynchronousDispatchScheduler(
             c.Resolve <IDispatchCommits>(),
             c.Resolve <IPersistStreams>());
         if (c.Resolve <DispatcherSchedulerStartup>() == DispatcherSchedulerStartup.Auto)
         {
             dispatchScheduler.Start();
         }
         return(dispatchScheduler);
     });
 }
 protected override void Context()
 {
     _dispatchScheduler = new SynchronousDispatchScheduler(_dispatchCommits, _persistStreams);
 }
 protected override void Because()
 {
     _dispatchScheduler = new SynchronousDispatchScheduler(_dispatcher, _persistence);
     _dispatchScheduler.Start();
 }
Example #8
0
 protected override void Context()
 {
     _dispatcher.Setup(x => x.Dispose());
     _persistence.Setup(x => x.Dispose());
     _dispatchScheduler = new SynchronousDispatchScheduler(_dispatcher.Object, _persistence.Object);
 }