From 9dce26aa8e6a09429adccf772841229625a20775 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Sun, 24 Mar 2024 15:53:16 +0100 Subject: [PATCH] Update libs (#228) * Indented * Update packages again. * Update libs again. --- .../Notifo.Domain.Integrations.csproj | 2 +- .../Events/EventsServiceExtensions.cs | 3 +- .../UserEvents/UserEventsServiceExtensions.cs | 12 ++++--- .../UserNotificationsServiceExtensions.cs | 18 +++++----- .../Notifo.Infrastructure.csproj | 28 +++++++-------- backend/src/Notifo/Notifo.csproj | 4 +-- backend/src/Notifo/ServiceExtensions.cs | 35 ++++++++++++------- backend/src/Notifo/Startup.cs | 4 +-- 8 files changed, 59 insertions(+), 47 deletions(-) diff --git a/backend/src/Notifo.Domain.Integrations/Notifo.Domain.Integrations.csproj b/backend/src/Notifo.Domain.Integrations/Notifo.Domain.Integrations.csproj index aa858ad7..f9c03620 100644 --- a/backend/src/Notifo.Domain.Integrations/Notifo.Domain.Integrations.csproj +++ b/backend/src/Notifo.Domain.Integrations/Notifo.Domain.Integrations.csproj @@ -9,7 +9,7 @@ - + diff --git a/backend/src/Notifo.Domain/Events/EventsServiceExtensions.cs b/backend/src/Notifo.Domain/Events/EventsServiceExtensions.cs index f5cf8e50..0070e9f7 100644 --- a/backend/src/Notifo.Domain/Events/EventsServiceExtensions.cs +++ b/backend/src/Notifo.Domain/Events/EventsServiceExtensions.cs @@ -22,7 +22,8 @@ public static void AddMyEvents(this IServiceCollection services, IConfiguration services.ConfigureAndValidate(config, "events"); - services.AddMessaging(new ChannelName(options.ChannelName), true); + services.AddMessaging() + .AddChannel(new ChannelName(options.ChannelName), true); services.Configure(messaging => { diff --git a/backend/src/Notifo.Domain/UserEvents/UserEventsServiceExtensions.cs b/backend/src/Notifo.Domain/UserEvents/UserEventsServiceExtensions.cs index 1a616d49..4349ac08 100644 --- a/backend/src/Notifo.Domain/UserEvents/UserEventsServiceExtensions.cs +++ b/backend/src/Notifo.Domain/UserEvents/UserEventsServiceExtensions.cs @@ -14,21 +14,23 @@ namespace Microsoft.Extensions.DependencyInjection; public static class UserEventsServiceExtensions { - public static void AddMyUserEvents(this IServiceCollection services, IConfiguration config) + public static MessagingBuilder AddMyUserEvents(this MessagingBuilder builder, IConfiguration config) { var options = config.GetSection("pipeline:userEvents").Get() ?? new UserEventPipelineOptions(); - services.AddMessaging(new ChannelName(options.ChannelName), true); + builder.AddChannel(new ChannelName(options.ChannelName), true); - services.Configure(messaging => + builder.Configure(messaging => { messaging.Routing.Add(x => x is UserEventMessage, options.ChannelName); }); - services.AddSingletonAs() + builder.Services.AddSingletonAs() .AsSelf().As(); - services.AddSingletonAs() + builder.Services.AddSingletonAs() .As(); + + return builder; } } diff --git a/backend/src/Notifo.Domain/UserNotifications/UserNotificationsServiceExtensions.cs b/backend/src/Notifo.Domain/UserNotifications/UserNotificationsServiceExtensions.cs index 3c522e79..af4853b5 100644 --- a/backend/src/Notifo.Domain/UserNotifications/UserNotificationsServiceExtensions.cs +++ b/backend/src/Notifo.Domain/UserNotifications/UserNotificationsServiceExtensions.cs @@ -16,29 +16,31 @@ namespace Microsoft.Extensions.DependencyInjection; public static class UserNotificationsServiceExtensions { - public static void AddMyUserNotifications(this IServiceCollection services, IConfiguration config) + public static MessagingBuilder AddMyUserNotifications(this MessagingBuilder builder, IConfiguration config) { var options = config.GetSection("pipeline:confirms").Get() ?? new ConfirmPipelineOptions(); - services.ConfigureAndValidate(config, "notifications"); + builder.Services.ConfigureAndValidate(config, "notifications"); - services.AddMessaging(new ChannelName(options.ChannelName), true); + builder.AddChannel(new ChannelName(options.ChannelName), true); - services.Configure(messaging => + builder.Configure(messaging => { messaging.Routing.Add(x => x is ConfirmMessage, options.ChannelName); }); - services.AddSingletonAs() + builder.Services.AddSingletonAs() .As(); - services.AddSingletonAs() + builder.Services.AddSingletonAs() .As(); - services.AddSingletonAs() + builder.Services.AddSingletonAs() .As().AsSelf().As>().As(); - services.AddScheduler("UserNotifications"); + builder.Services.AddScheduler("UserNotifications"); + + return builder; } public static void AddMyMongoUserNotifications(this IServiceCollection services) diff --git a/backend/src/Notifo.Infrastructure/Notifo.Infrastructure.csproj b/backend/src/Notifo.Infrastructure/Notifo.Infrastructure.csproj index c90f54b1..fd04691e 100644 --- a/backend/src/Notifo.Infrastructure/Notifo.Infrastructure.csproj +++ b/backend/src/Notifo.Infrastructure/Notifo.Infrastructure.csproj @@ -29,20 +29,20 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/backend/src/Notifo/Notifo.csproj b/backend/src/Notifo/Notifo.csproj index d06f3d13..7e72a779 100644 --- a/backend/src/Notifo/Notifo.csproj +++ b/backend/src/Notifo/Notifo.csproj @@ -23,14 +23,14 @@ - + - + diff --git a/backend/src/Notifo/ServiceExtensions.cs b/backend/src/Notifo/ServiceExtensions.cs index e32ee724..87c5f6ab 100644 --- a/backend/src/Notifo/ServiceExtensions.cs +++ b/backend/src/Notifo/ServiceExtensions.cs @@ -62,6 +62,14 @@ public static void AddMyStorage(this IServiceCollection services, IConfiguration }); } + public static void AddMyMessaging(this IServiceCollection services, IConfiguration config) + { + services.AddMessaging() + .AddTransport(config) + .AddMyUserEvents(config) + .AddMyUserNotifications(config); + } + public static void AddMyClustering(this IServiceCollection services, IConfiguration config, SignalROptions signalROptions) { config.ConfigureByOption("clustering:type", new Alternatives @@ -79,22 +87,23 @@ public static void AddMyClustering(this IServiceCollection services, IConfigurat }); } - services.AddRedisTransport(config, options => - { - options.ConnectionFactory = connection.ConnectAsync; - }); - - services.AddReplicatedCacheMessaging(true, options => - { - options.TransportSelector = (transports, name) => transports.First(x => x is RedisTransport); - }); + services.AddMessaging() + .AddRedisTransport(config, options => + { + options.ConnectionFactory = connection.ConnectAsync; + }) + .AddReplicatedCache(true, options => + { + options.TransportSelector = (transports, name) => transports.First(x => x is RedisTransport); + }); }, ["None"] = () => { - services.AddReplicatedCacheMessaging(false, options => - { - options.TransportSelector = (transports, name) => transports.First(x => x is NullTransport); - }); + services.AddMessaging() + .AddReplicatedCache(false, options => + { + options.TransportSelector = (transports, name) => transports.First(x => x is NullTransport); + }); } }); } diff --git a/backend/src/Notifo/Startup.cs b/backend/src/Notifo/Startup.cs index 1bcffd6c..bc71307f 100644 --- a/backend/src/Notifo/Startup.cs +++ b/backend/src/Notifo/Startup.cs @@ -127,7 +127,7 @@ public void ConfigureServices(IServiceCollection services) services.AddMyJson(ConfigureJson); services.AddMyLog(); services.AddMyMedia(); - services.AddMessagingTransport(config); + services.AddMyMessaging(config); services.AddMyMessagingChannel(); services.AddMyMobilePushChannel(); services.AddMyNodaTime(); @@ -138,8 +138,6 @@ public void ConfigureServices(IServiceCollection services) services.AddMyTelemetry(config); services.AddMyTemplates(); services.AddMyTopics(); - services.AddMyUserEvents(config); - services.AddMyUserNotifications(config); services.AddMyUsers(); services.AddMyUtils(); services.AddMyWebChannel();