Rfactored service bus service lifetime

This commit is contained in:
Khwezi Mngoma
2026-05-09 08:37:45 +02:00
parent 33633502e2
commit d998aac7c4
7 changed files with 9 additions and 9 deletions
@@ -11,7 +11,7 @@
<!-- Nuget Package Details --> <!-- Nuget Package Details -->
<PropertyGroup> <PropertyGroup>
<PackageId>LiteCharms.Abstractions</PackageId> <PackageId>LiteCharms.Abstractions</PackageId>
<Version>1.0.17</Version> <Version>1.0.19</Version>
<Authors>Khwezi Mngoma</Authors> <Authors>Khwezi Mngoma</Authors>
<Company>Lite Charms (PTY) Ltd</Company> <Company>Lite Charms (PTY) Ltd</Company>
<Description>Shared abstractions for Lite Charms applications.</Description> <Description>Shared abstractions for Lite Charms applications.</Description>
@@ -11,7 +11,7 @@
<!-- Nuget Package Details --> <!-- Nuget Package Details -->
<PropertyGroup> <PropertyGroup>
<PackageId>LiteCharms.Entities</PackageId> <PackageId>LiteCharms.Entities</PackageId>
<Version>1.0.17</Version> <Version>1.0.19</Version>
<Authors>Khwezi Mngoma</Authors> <Authors>Khwezi Mngoma</Authors>
<Company>Lite Charms (PTY) Ltd</Company> <Company>Lite Charms (PTY) Ltd</Company>
<Description>Shared entities for Lite Charms applications.</Description> <Description>Shared entities for Lite Charms applications.</Description>
@@ -22,7 +22,7 @@
<!-- Nuget Package Details --> <!-- Nuget Package Details -->
<PropertyGroup> <PropertyGroup>
<PackageId>LiteCharms.Extensions</PackageId> <PackageId>LiteCharms.Extensions</PackageId>
<Version>1.0.18</Version> <Version>1.0.19</Version>
<Authors>Khwezi Mngoma</Authors> <Authors>Khwezi Mngoma</Authors>
<Company>Lite Charms (PTY) Ltd</Company> <Company>Lite Charms (PTY) Ltd</Company>
<Description>Extension components for Lite Charms applications.</Description> <Description>Extension components for Lite Charms applications.</Description>
+3 -3
View File
@@ -7,19 +7,19 @@ namespace LiteCharms.Extensions;
public static class ServiceBus public static class ServiceBus
{ {
public static IServiceCollection AddGeneralServiceBus(this IServiceCollection services) => services public static IServiceCollection AddGeneralServiceBus(this IServiceCollection services) => services
.AddSingleton<GeneralServiceBus>() .AddTransient<GeneralServiceBus>()
.AddHostedService<GeneralExchange>() .AddHostedService<GeneralExchange>()
.AddKeyedTransient<IEventBus, GeneralServiceBus>(Constants.GeneralServiceBus) .AddKeyedTransient<IEventBus, GeneralServiceBus>(Constants.GeneralServiceBus)
.AddMemoryCache(); .AddMemoryCache();
public static IServiceCollection AddEmailServiceBus(this IServiceCollection services) => services public static IServiceCollection AddEmailServiceBus(this IServiceCollection services) => services
.AddSingleton<EmailServiceBus>() .AddTransient<EmailServiceBus>()
.AddHostedService<EmailExchange>() .AddHostedService<EmailExchange>()
.AddKeyedTransient<IEventBus, EmailServiceBus>(Constants.EmailServiceBus) .AddKeyedTransient<IEventBus, EmailServiceBus>(Constants.EmailServiceBus)
.AddMemoryCache(); .AddMemoryCache();
public static IServiceCollection AddSalesServiceBus(this IServiceCollection services) => services public static IServiceCollection AddSalesServiceBus(this IServiceCollection services) => services
.AddSingleton<SalesServiceBus>() .AddTransient<SalesServiceBus>()
.AddHostedService<SalesExchange>() .AddHostedService<SalesExchange>()
.AddKeyedTransient<IEventBus, SalesServiceBus>(Constants.SalesServiceBus) .AddKeyedTransient<IEventBus, SalesServiceBus>(Constants.SalesServiceBus)
.AddMemoryCache(); .AddMemoryCache();
@@ -11,7 +11,7 @@
<!-- Nuget Package Details --> <!-- Nuget Package Details -->
<PropertyGroup> <PropertyGroup>
<PackageId>LiteCharms.Features</PackageId> <PackageId>LiteCharms.Features</PackageId>
<Version>1.0.17</Version> <Version>1.0.19</Version>
<Authors>Khwezi Mngoma</Authors> <Authors>Khwezi Mngoma</Authors>
<Company>Lite Charms (PTY) Ltd</Company> <Company>Lite Charms (PTY) Ltd</Company>
<Description>Feature components for Lite Charms applications.</Description> <Description>Feature components for Lite Charms applications.</Description>
@@ -12,7 +12,7 @@
<!-- Nuget Package Details --> <!-- Nuget Package Details -->
<PropertyGroup> <PropertyGroup>
<PackageId>LiteCharms.Infrastructure</PackageId> <PackageId>LiteCharms.Infrastructure</PackageId>
<Version>1.0.17</Version> <Version>1.0.19</Version>
<Authors>Khwezi Mngoma</Authors> <Authors>Khwezi Mngoma</Authors>
<Company>Lite Charms (PTY) Ltd</Company> <Company>Lite Charms (PTY) Ltd</Company>
<Description>Infrastructure components for Lite Charms applications.</Description> <Description>Infrastructure components for Lite Charms applications.</Description>
+1 -1
View File
@@ -11,7 +11,7 @@
<!-- Nuget Package Details --> <!-- Nuget Package Details -->
<PropertyGroup> <PropertyGroup>
<PackageId>LiteCharms.Models</PackageId> <PackageId>LiteCharms.Models</PackageId>
<Version>1.0.17</Version> <Version>1.0.19</Version>
<Authors>Khwezi Mngoma</Authors> <Authors>Khwezi Mngoma</Authors>
<Company>Lite Charms (PTY) Ltd</Company> <Company>Lite Charms (PTY) Ltd</Company>
<Description>Shared models for Lite Charms applications.</Description> <Description>Shared models for Lite Charms applications.</Description>