public async Task Verify_disable_check_on_creation_by_two_different_event_honor_offline_events() { JarvisFrameworkGlobalConfiguration.DisableOfflineEventsReadmodelIdempotencyCheck(); var rm = new SampleReadModelTest { Id = new TestId(1), Value = "test" }; SampleAggregateCreated offlineEvent = new SampleAggregateCreated(); SampleAggregateCreated onlineEvent = new SampleAggregateCreated(); onlineEvent.SetPropertyValue(_ => _.Context, new Dictionary <string, Object>()); onlineEvent.Context.Add(MessagesConstants.OfflineEvents, new DomainEvent[] { offlineEvent }); await sut.InsertAsync(offlineEvent, rm).ConfigureAwait(false); //this should NOT be ignored, because I've disabled the readmodelidempotency check. Assert.ThrowsAsync <CollectionWrapperException>(async() => await sut.InsertAsync(onlineEvent, rm)); }
public async Task Verify_check_on_creation_by_two_different_event_honor_offline_events() { JarvisFrameworkGlobalConfiguration.EnableOfflineEventsReadmodelIdempotencyCheck(); var rm = new SampleReadModelTest { Id = new TestId(1), Value = "test" }; SampleAggregateCreated offlineEvent = new SampleAggregateCreated(); SampleAggregateCreated onlineEvent = new SampleAggregateCreated(); onlineEvent.SetPropertyValue(_ => _.Context, new Dictionary <string, Object>()); onlineEvent.Context.Add(MessagesConstants.OfflineEvents, new DomainEvent[] { offlineEvent }); await sut.InsertAsync(offlineEvent, rm).ConfigureAwait(false); //this should be ignored, because the online event was generated with the same command of the offlineEvent //and this should simply skip the insertion. await sut.InsertAsync(onlineEvent, rm).ConfigureAwait(false); }
public void Start(DocumentStoreConfiguration config) { _config = config; BuildContainer(config); if (_config.EnableSingleAggregateRepositoryCache) { _logger.InfoFormat("Single Aggregate Repository Cache - ENABLED"); JarvisFrameworkGlobalConfiguration.EnableSingleAggregateRepositoryCache(); } else { _logger.InfoFormat("Single Aggregate Repository Cache - DISABLED"); JarvisFrameworkGlobalConfiguration.DisableSingleAggregateRepositoryCache(); } if (_config.DisableRepositoryLockOnAggregateId) { _logger.InfoFormat("Repository lock on Aggregate Id - DISABLED"); NeventStoreExGlobalConfiguration.DisableRepositoryLockOnAggregateId(); } else { _logger.InfoFormat("Repository lock on Aggregate Id - ENABLED"); NeventStoreExGlobalConfiguration.EnableRepositoryLockOnAggregateId(); } Manager = BuildTenants(_container, config); //Setup database check. foreach (var tenant in _config.TenantSettings) { foreach (var connection in _databaseNames) { #pragma warning disable S1848 // Objects should not be created to be dropped immediately without being used new DatabaseHealthCheck( String.Format("Tenant: {0} [Db:{1}]", tenant.TenantId, connection), tenant.GetConnectionString(connection)); #pragma warning restore S1848 // Objects should not be created to be dropped immediately without being used } } while (!StartupCheck()) { _logger.InfoFormat("Some precondition to start the service are not met. Will retry in 3 seconds!"); Thread.Sleep(3000); } if (RebuildSettings.ShouldRebuild && Environment.UserInteractive) { Console.WriteLine("---> Set Log Level to INFO to speedup rebuild (y/N)?"); var res = Console.ReadLine().Trim().ToLowerInvariant(); if (res == "y") { SetLogLevelTo("INFO"); } } _logger.DebugFormat( "Roles:\n api: {0}\n worker : {1}\n projections: {2}", config.IsApiServer, config.IsWorker, config.IsReadmodelBuilder ); InitializeEverything(config); //Check if container misconfigured _container.CheckConfiguration(); }