private IStoreEvents getInitializedEventStore(IDispatchCommits dispatchCommits) { return Wireup.Init() .UsingRavenPersistence("Raven") .UsingSynchronousDispatchScheduler(dispatchCommits) .Build(); }
public SynchronousDispatchScheduler(IDispatchCommits dispatcher, IPersistStreams persistence) { _dispatcher = dispatcher; _persistence = persistence; Logger.Info(Resources.StartingDispatchScheduler); }
private IStoreEvents getInitializedEventStore(IDispatchCommits dispatchCommits) { return(Wireup.Init() .UsingRavenPersistence("Raven") .UsingSynchronousDispatchScheduler(dispatchCommits) .Build()); }
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 SynchronousDispatchScheduler(IDispatchCommits dispatcher, IPersistStreams persistence) { _dispatcher = dispatcher; _persistence = persistence; Logger.Info(Resources.StartingDispatchScheduler); }
public static SynchronousDispatchSchedulerWireup UsingSynchronousDispatchScheduler( this Wireup wireup, IDispatchCommits dispatcher, DispatcherSchedulerStartup schedulerStartup = DispatcherSchedulerStartup.Auto) { return new SynchronousDispatchSchedulerWireup(wireup, dispatcher, schedulerStartup); }
public EventSource UsingAsynchronousDispatchScheduler(IDispatchCommits instance) { var dispatcher = new AsynchronousDispatchScheduler(instance, _store); _pipelineHooks.Add(new DispatchSchedulerPipelineHook(dispatcher)); _hasDispatcher = true; return(this); }
private IStoreEvents GetEventStore(IDispatchCommits bus) { return Wireup.Init() .UsingSqlPersistence(sqlConnectionStringName).InitializeStorageEngine() .UsingJsonSerialization().Compress() //.EncryptWith(encryptionKey) .UsingSynchronousDispatchScheduler().DispatchTo(bus) .Build(); }
public SynchronousDispatchSchedulerWireup(Wireup wireup, IDispatchCommits dispatcher) : base(wireup) { Logger.Debug(Messages.SyncDispatchSchedulerRegistered); this.DispatchTo(dispatcher ?? new NullDispatcher()); this.Container.Register<IScheduleDispatches>(c => new SynchronousDispatchScheduler( c.Resolve<IDispatchCommits>(), c.Resolve<IPersistStreams>())); }
private static IStoreEvents GetInitializedEventStore(IDispatchCommits bus) { return Wireup.Init() .UsingSqlPersistence("EventStore") .UsingJsonSerialization() .UsingSynchronousDispatchScheduler(bus) .Build(); }
public SynchronousDispatchSchedulerWireup(Wireup wireup, IDispatchCommits dispatcher) : base(wireup) { Logger.Debug(Messages.SyncDispatchSchedulerRegistered); DispatchTo(dispatcher ?? new NullDispatcher()); Container.Register <IScheduleDispatches>(c => new SynchronousDispatchScheduler( c.Resolve <IDispatchCommits>(), c.Resolve <IPersistStreams>())); }
private IStoreEvents GetInitializedEventStore(IDispatchCommits bus) { return(Wireup.Init() .UsingAsynchronousDispatchScheduler(bus) .UsingRavenPersistence(Keys.RavenDbConnectionStringName) .ConsistentQueries() .PageEvery(int.MaxValue) .MaxServerPageSizeConfiguration(1024) .Build()); }
public void ReplayEvents(IDispatchCommits dispatcher) { if (!_isInitialized) { throw new Exception("Initialize Event Source first!"); } var databaseName = DatabaseName.Invoke(); PrepareDatabase(databaseName); // wait for indexing to complete var indexingTask = Task.Factory.StartNew( () => { while (true) { var s = string.IsNullOrWhiteSpace(databaseName) ? _store.DatabaseCommands.GetStatistics().StaleIndexes : _store.DatabaseCommands.ForDatabase(databaseName).GetStatistics().StaleIndexes; if (!s.Contains("EventStreamCommits")) { break; } Thread.Sleep(2000); } }); indexingTask.Wait(120000); var current = 0; while (true) { using (var session = string.IsNullOrWhiteSpace(databaseName) ? _store.OpenSession() : _store.OpenSession(databaseName)) { var commits = session.Query <Commit, EventStreamCommits>() .Customize(x => x.WaitForNonStaleResultsAsOfNow()) .OrderBy(x => x.CommitStamp) .Skip(current) .Take(1024) .ToList(); if (commits.Count == 0) { break; } commits = FilteredCommits(commits); commits.ForEach(dispatcher.Dispatch); current += commits.Count; } } }
public DmsEventProjection(IConnection connection, IDocumentService documentService, IDispatchCommits dispatcher, ILog logger, ITranslationService translationService) { _documentService = documentService; _dispatcher = dispatcher; _translationService = translationService; _logger = logger; _consumer = new RabbitMqSubscription(connection, "Cev-Exchange", logger); _consumer .WithAppName("dms-projection") .WithEvent <CreateDocumentPartEvent>(Handle); }
public AsynchronousDispatchSchedulerWireup(Wireup wireup, IDispatchCommits dispatcher) : base(wireup) { var option = this.Container.Resolve<TransactionScopeOption>(); if (option == TransactionScopeOption.Required) Logger.Warn(Messages.SynchronousDispatcherTwoPhaseCommits); Logger.Debug(Messages.AsyncDispatchSchedulerRegistered); this.DispatchTo(dispatcher ?? new NullDispatcher()); this.Container.Register<IScheduleDispatches>(c => new AsynchronousDispatchScheduler( c.Resolve<IDispatchCommits>(), c.Resolve<IPersistStreams>())); }
private static IStoreEvents GetEventStore(IDispatchCommits bus) { var connectionFactory = new ConnectionFactory(@"Data Source=.\SQLEXPRESS;Initial Catalog=SuiteEvents;Integrated Security=SSPI;", "System.Data.SqlClient"); //.UsingSqlPersistence(connectionFactory).InitializeStorageEngine() return(Wireup.Init() .UsingInMemoryPersistence() .UsingJsonSerialization().Compress() .UsingSynchronousDispatchScheduler().DispatchTo(bus) .Build()); }
public AsynchronousDispatchSchedulerWireup(Wireup wireup, IDispatchCommits dispatcher) : base(wireup) { var option = this.Container.Resolve <TransactionScopeOption>(); if (option != TransactionScopeOption.Suppress) { Logger.Warn(Messages.SynchronousDispatcherTwoPhaseCommits); } Logger.Debug(Messages.AsyncDispatchSchedulerRegistered); this.DispatchTo(dispatcher ?? new NullDispatcher()); this.Container.Register <IScheduleDispatches>(c => new AsynchronousDispatchScheduler( c.Resolve <IDispatchCommits>(), c.Resolve <IPersistStreams>())); }
private static IStoreEvents GetWiredEventStoreWrapper(IDispatchCommits dispatcher) { var types = Assembly.GetAssembly(typeof(Event)) .GetTypes() .Where(type => type.IsSubclassOf(typeof(Event))); foreach (var t in types) BsonClassMap.LookupClassMap(t); var store = Wireup.Init() .UsingMongoPersistence("eventstore", new DocumentObjectSerializer()) .UsingSynchronousDispatchScheduler() .DispatchTo(dispatcher) .Build(); return store; }
/// <summary> /// Initialize RavenDB NEventStore /// </summary> /// <returns></returns> private IStoreEvents GetInitializedEventStore(IDispatchCommits commits, string eventStore) { if (eventStore.Equals(Constants.OUTPUT_EVENT_STORE)) { return(Wireup.Init() .UsingRavenPersistence(Constants.RAVEN_DB_CONNECTIONSTRING_NAME) .DefaultDatabase(eventStore) .UsingAsynchronousDispatchScheduler(commits) .Build()); } return(Wireup.Init() .UsingRavenPersistence(Constants.RAVEN_DB_CONNECTIONSTRING_NAME) .DefaultDatabase(eventStore) .UsingAsynchronousDispatchScheduler(null) .Build()); }
public SynchronousDispatchSchedulerWireup(Wireup wireup, IDispatchCommits dispatcher, DispatcherSchedulerStartup schedulerStartup) : base(wireup) { Logger.Debug(Messages.SyncDispatchSchedulerRegistered); DispatchTo(dispatcher ?? new NullDispatcher()); Container.Register<IScheduleDispatches>(c => { var dispatchScheduler = new SynchronousDispatchScheduler( c.Resolve<IDispatchCommits>(), c.Resolve<IPersistStreams>()); if (schedulerStartup == DispatcherSchedulerStartup.Auto) { dispatchScheduler.Start(); } return dispatchScheduler; }); }
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); }); }
private static IStoreEvents CreateEventStore(IDispatchCommits bus) { return Wireup.Init() .LogToOutputWindow() //.UsingInMemoryPersistence() .UsingSqlPersistence("NEventStoreConnectionString") // Connection string is in app.config .WithDialect(new MsSqlDialect()) .EnlistInAmbientTransaction() // two-phase commit .InitializeStorageEngine() //.TrackPerformanceInstance("example") .UsingJsonSerialization() .Compress() //.EncryptWith(EncryptionKey) .HookIntoPipelineUsing(new AuthorizationPipelineHook()) .UsingSynchronousDispatchScheduler() .DispatchTo(bus) .Build(); }
private static IStoreEvents CreateEventStore(IDispatchCommits bus) { return(Wireup.Init() .LogToOutputWindow() //.UsingInMemoryPersistence() .UsingSqlPersistence("NEventStoreConnectionString") // Connection string is in app.config .WithDialect(new MsSqlDialect()) .EnlistInAmbientTransaction() // two-phase commit .InitializeStorageEngine() //.TrackPerformanceInstance("example") .UsingJsonSerialization() .Compress() //.EncryptWith(EncryptionKey) .HookIntoPipelineUsing(new AuthorizationPipelineHook()) .UsingSynchronousDispatchScheduler() .DispatchTo(bus) .Build()); }
public AsynchronousDispatchSchedulerWireup(Wireup wireup, IDispatchCommits dispatcher, DispatcherSchedulerStartup schedulerStartup) : base(wireup) { var option = Container.Resolve<TransactionScopeOption>(); if (option != TransactionScopeOption.Suppress) { Logger.Warn(Messages.SynchronousDispatcherTwoPhaseCommits); } Logger.Debug(Messages.AsyncDispatchSchedulerRegistered); DispatchTo(dispatcher ?? new NullDispatcher()); Container.Register<IScheduleDispatches>(c => { var dispatchScheduler = new AsynchronousDispatchScheduler( c.Resolve<IDispatchCommits>(), c.Resolve<IPersistStreams>()); if (schedulerStartup == DispatcherSchedulerStartup.Auto) { dispatchScheduler.Start(); } return dispatchScheduler; }); }
public SynchronousDispatchScheduler(IDispatchCommits dispatcher, IDocumentStore store) { _dispatcher = dispatcher; _store = store; }
public static AsynchronousDispatchSchedulerWireup UsingAsynchronousDispatchScheduler( this Wireup wireup, IDispatchCommits dispatcher) { return new AsynchronousDispatchSchedulerWireup(wireup, dispatcher, DispatcherSchedulerStartup.Auto); }
public AsynchronousDispatchSchedulerWireup DispatchTo(IDispatchCommits instance) { Logger.Debug(Messages.DispatcherRegistered, instance.GetType()); this.Container.Register(instance); return this; }
public static Setup WithMongoEventStore(this Setup setup, string configConnectionKey, IPipelineHook hook, IDispatchCommits dispatcher, bool output) { var types = Assembly.GetAssembly(typeof(FreelanceManager.Events.Event)) .GetTypes() .Where(type => type.IsClass && !type.ContainsGenericParameters) .Where(type => type.IsSubclassOf(typeof(FreelanceManager.Events.Event)) || type.Namespace.Contains("FreelanceManager.Dtos")); foreach (var t in types) BsonClassMap.LookupClassMap(t); BsonClassMap.LookupClassMap(typeof(Date)); BsonClassMap.LookupClassMap(typeof(Time)); BsonClassMap.LookupClassMap(typeof(Money)); var eventStoreSetup = Wireup.Init() .UsingMongoPersistence(configConnectionKey, new DocumentObjectSerializer()) .InitializeStorageEngine(); if (output) eventStoreSetup.LogToOutputWindow(); if (hook != null) eventStoreSetup.HookIntoPipelineUsing(hook); if (dispatcher != null) eventStoreSetup.UsingSynchronousDispatchScheduler() .DispatchTo(dispatcher); var builder = new ContainerBuilder(); builder.RegisterInstance<IStoreEvents>(eventStoreSetup.Build()).ExternallyOwned(); builder.RegisterType<AggregateRootRepository>().As<IAggregateRootRepository>(); builder.Update(setup.Container.ComponentRegistry); return setup; }
public ConfigNcqrs UseDispatcher(IDispatchCommits commitDispatcher) { Configurer.RegisterSingleton(typeof(IDispatchCommits), commitDispatcher); return this; }
public ReadModelCommitObserver(ICheckpointRepository checkpointRepo, IDispatchCommits dispatcher) { Contract.Requires <ArgumentNullException>(checkpointRepo != null, "checkpointRepo"); this.checkpointRepo = checkpointRepo; this.dispatcher = dispatcher; }
public NEventStoreWithSyncDispatcherFactory(IDispatchCommits syncDispatcher) { this.syncDispatcher = syncDispatcher; }
public static SynchronousDispatchSchedulerWireup UsingSynchronousDispatchScheduler( this Wireup wireup, IDispatchCommits dispatcher) { return(new SynchronousDispatchSchedulerWireup(wireup, dispatcher)); }
public static DispatchSchedulerWireup UsingDispatchScheduler(this Wireup wireup, IDispatchCommits dispatcher) { return(new DispatchSchedulerWireup(wireup, dispatcher)); }
public Eventstore(IDispatchCommits dispatcher) { _dispatcher = dispatcher; }
public AsynchronousDispatchScheduler(IDispatchCommits dispatcher, IPersistStreams persistence) : base(dispatcher, persistence) { }
public AsynchronousDispatchScheduler(IDispatchCommits dispatcher, IPersistStreams persistence) : base(dispatcher, persistence) { _queue = new BlockingCollection<ICommit>(new ConcurrentQueue<ICommit>(), BoundedCapacity); }
public DispatchPipelineHook(IDispatchCommits dispatcher) { this.dispatcher = dispatcher ?? new NullDispatcher(); }
public DispatchSchedulerWireup(Wireup wireup, IDispatchCommits dispatcher) : base(wireup) { DispatchTo(dispatcher ?? new NullDispatcher()); Container.Register <IScheduleDispatches>(c => new DispatchScheduler(c.Resolve <IDispatchCommits>(), c.Resolve <IPersistStreams>())); }
public OptimisticEventStore(IPersistStreams persistence, IDispatchCommits dispatcher) { this.persistence = persistence; this.dispatcher = dispatcher; }
public DispatchPipelineHook(IDispatchCommits dispatcher) { this.dispatcher = dispatcher ?? new NullDispatcher(); }
public DispatchSchedulerWireup DispatchTo(IDispatchCommits instance) { Container.Register(instance); return(this); }
public AsynchronousDispatchScheduler(IDispatchCommits dispatcher, IPersistStreams persistence) : base(dispatcher, persistence) { _queue = new BlockingCollection <ICommit>(new ConcurrentQueue <ICommit>(), BoundedCapacity); }
public AsynchronousDispatchScheduler(IDispatchCommits dispatcher, IDocumentStore store) : base(dispatcher, store) { }
/// <summary> /// Initializes a new instance of the <see cref="EventStoreFactory" /> class. /// </summary> /// <param name="commitDispatcher">The commit dispatcher.</param> public EventStoreFactory(IDispatchCommits commitDispatcher) { _commitDispatcher = commitDispatcher; }
public SynchronousDispatchSchedulerWireup DispatchTo(IDispatchCommits instance) { Logger.Debug(Messages.DispatcherRegistered, instance.GetType()); Container.Register(instance); return(this); }
public AsynchronousDispatchScheduler(IDispatchCommits dispatcher, IPersistStreams persistence) : base(dispatcher, persistence) {}
public static AsynchronousDispatchSchedulerWireup UsingAsynchronousDispatchScheduler( this Wireup wireup, IDispatchCommits dispatcher) { return(new AsynchronousDispatchSchedulerWireup(wireup, dispatcher, DispatcherSchedulerStartup.Auto)); }
public static SynchronousDispatchSchedulerWireup UsingSynchronousDispatchScheduler( this Wireup wireup, IDispatchCommits dispatcher) { return new SynchronousDispatchSchedulerWireup(wireup, dispatcher); }