diff --git a/src/PostalRegistry.Projector/Infrastructure/Modules/ApiModule.cs b/src/PostalRegistry.Projector/Infrastructure/Modules/ApiModule.cs index ca1f1975..dbc33c6c 100755 --- a/src/PostalRegistry.Projector/Infrastructure/Modules/ApiModule.cs +++ b/src/PostalRegistry.Projector/Infrastructure/Modules/ApiModule.cs @@ -33,6 +33,8 @@ public class ApiModule : Module private readonly IServiceCollection _services; private readonly ILoggerFactory _loggerFactory; + private readonly ConnectedProjectionSettings _connectedProjectionSettings; + public ApiModule( IConfiguration configuration, IServiceCollection services, @@ -41,6 +43,13 @@ public ApiModule( _configuration = configuration; _services = services; _loggerFactory = loggerFactory; + + var catchUpSize = configuration.GetValue("CatchUpSize", 100); + + _connectedProjectionSettings = ConnectedProjectionSettings + .Configure(x => x + .ConfigureCatchUpPageSize(catchUpSize) + .ConfigureCatchUpUpdatePositionMessageInterval(catchUpSize)); } protected override void Load(ContainerBuilder builder) @@ -59,10 +68,9 @@ protected override void Load(ContainerBuilder builder) private void RegisterProjectionSetup(ContainerBuilder builder) { builder.RegisterModule( - new EventHandlingModule( - typeof(DomainAssemblyMarker).Assembly, - EventsJsonSerializerSettingsProvider.CreateSerializerSettings())) - + new EventHandlingModule( + typeof(DomainAssemblyMarker).Assembly, + EventsJsonSerializerSettingsProvider.CreateSerializerSettings())) .RegisterModule() .RegisterEventstreamModule(_configuration) .RegisterModule(new ProjectorModule(_configuration)); @@ -71,7 +79,7 @@ private void RegisterProjectionSetup(ContainerBuilder builder) RegisterLastChangedProjections(builder); RegisterLegacyProjections(builder); - if(_configuration.GetSection("Integration").GetValue("Enabled", false)) + if (_configuration.GetSection("Integration").GetValue("Enabled", false)) RegisterIntegrationProjections(builder); } @@ -83,13 +91,14 @@ private void RegisterIntegrationProjections(ContainerBuilder builder) _configuration, _services, _loggerFactory)); + builder .RegisterProjectionMigrator( _configuration, _loggerFactory) .RegisterProjections( context => new PostalLatestItemProjections(context.Resolve>()), - ConnectedProjectionSettings.Default); + _connectedProjectionSettings); } private void RegisterExtractProjections(ContainerBuilder builder) @@ -105,8 +114,9 @@ private void RegisterExtractProjections(ContainerBuilder builder) _configuration, _loggerFactory) .RegisterProjections( - context => new PostalInformationExtractProjections(context.Resolve>(), DbaseCodePage.Western_European_ANSI.ToEncoding()), - ConnectedProjectionSettings.Default); + context => new PostalInformationExtractProjections(context.Resolve>(), + DbaseCodePage.Western_European_ANSI.ToEncoding()), + _connectedProjectionSettings); } private void RegisterLastChangedProjections(ContainerBuilder builder) @@ -119,13 +129,14 @@ private void RegisterLastChangedProjections(ContainerBuilder builder) _loggerFactory)); builder - .RegisterProjectionMigrator( + .RegisterProjectionMigrator< + PostalRegistry.Projections.LastChangedList.LastChangedListContextMigrationFactory>( _configuration, _loggerFactory) .RegisterProjectionMigrator( _configuration, _loggerFactory) - .RegisterProjections(ConnectedProjectionSettings.Default); + .RegisterProjections(_connectedProjectionSettings); } private void RegisterLegacyProjections(ContainerBuilder builder) @@ -140,8 +151,8 @@ private void RegisterLegacyProjections(ContainerBuilder builder) .RegisterProjectionMigrator( _configuration, _loggerFactory) - .RegisterProjections(ConnectedProjectionSettings.Default) - .RegisterProjections(ConnectedProjectionSettings.Default); + .RegisterProjections(_connectedProjectionSettings) + .RegisterProjections(_connectedProjectionSettings); } } } diff --git a/src/PostalRegistry.Projector/appsettings.json b/src/PostalRegistry.Projector/appsettings.json index 4d7d2284..05ccd1eb 100755 --- a/src/PostalRegistry.Projector/appsettings.json +++ b/src/PostalRegistry.Projector/appsettings.json @@ -12,6 +12,8 @@ "IntegrationProjectionsAdmin": "." }, + "CatchUpSize": 100, + "DataDog": { "Enabled": false, "Debug": false,