Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor mq #726

Merged
merged 1 commit into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/Mixcore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "mix-message-queue", "mix-me
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.mq.lib", "services\mix-message-queue\mix.mq.lib\mix.mq.lib.csproj", "{70E0E3FE-11A6-4342-AFD7-D2E5E3CB2658}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.mq", "services\mix-message-queue\mix.mq\mix.mq.csproj", "{BB464A87-7C6E-4B4D-805A-91560D81EAA3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "mix-auth-service", "mix-auth-service", "{EC933357-1D95-4CDD-B290-7A5984FC1AA2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.auth.service", "services\mix-auth-service\mix.auth.service\mix.auth.service.csproj", "{D503F737-90E6-438F-ACB2-1074CACEE407}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.mq.server", "services\mix-message-queue\mix.mq.server\mix.mq.server.csproj", "{7C5101F3-E3E6-42DB-8585-D08C2BE5E30C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -285,14 +285,14 @@ Global
{70E0E3FE-11A6-4342-AFD7-D2E5E3CB2658}.Debug|Any CPU.Build.0 = Debug|Any CPU
{70E0E3FE-11A6-4342-AFD7-D2E5E3CB2658}.Release|Any CPU.ActiveCfg = Release|Any CPU
{70E0E3FE-11A6-4342-AFD7-D2E5E3CB2658}.Release|Any CPU.Build.0 = Release|Any CPU
{BB464A87-7C6E-4B4D-805A-91560D81EAA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB464A87-7C6E-4B4D-805A-91560D81EAA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB464A87-7C6E-4B4D-805A-91560D81EAA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB464A87-7C6E-4B4D-805A-91560D81EAA3}.Release|Any CPU.Build.0 = Release|Any CPU
{D503F737-90E6-438F-ACB2-1074CACEE407}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D503F737-90E6-438F-ACB2-1074CACEE407}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D503F737-90E6-438F-ACB2-1074CACEE407}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D503F737-90E6-438F-ACB2-1074CACEE407}.Release|Any CPU.Build.0 = Release|Any CPU
{7C5101F3-E3E6-42DB-8585-D08C2BE5E30C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C5101F3-E3E6-42DB-8585-D08C2BE5E30C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C5101F3-E3E6-42DB-8585-D08C2BE5E30C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C5101F3-E3E6-42DB-8585-D08C2BE5E30C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -356,9 +356,9 @@ Global
{F5D4C70F-DD2E-4EC9-A191-56A717B1B5EE} = {B4C40E02-E06A-4359-BDC5-349E103366AD}
{C93898B7-2001-4C29-9BBE-33A2E61C350A} = {C0A05428-767E-46C5-A31F-0D220E41F7C5}
{70E0E3FE-11A6-4342-AFD7-D2E5E3CB2658} = {C93898B7-2001-4C29-9BBE-33A2E61C350A}
{BB464A87-7C6E-4B4D-805A-91560D81EAA3} = {C93898B7-2001-4C29-9BBE-33A2E61C350A}
{EC933357-1D95-4CDD-B290-7A5984FC1AA2} = {C0A05428-767E-46C5-A31F-0D220E41F7C5}
{D503F737-90E6-438F-ACB2-1074CACEE407} = {EC933357-1D95-4CDD-B290-7A5984FC1AA2}
{7C5101F3-E3E6-42DB-8585-D08C2BE5E30C} = {C93898B7-2001-4C29-9BBE-33A2E61C350A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0143C230-7F40-44B2-8BA3-EF5B92D55848}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
.WithReference(mixcore)
;

builder.AddProject<Projects.mix_mq>("mix.mq");
builder.AddProject<Projects.mix_mq_server>("mix.mq.server");

//builder.AddProject<Projects.mix_auth_service>("mix.auth.service");
builder.AddProject<Projects.mix_auth_service>("mix.auth.service");

builder.Build().Run();
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

<ItemGroup>
<ProjectReference Include="..\..\..\services\mix-auth-service\mix.auth.service\mix.auth.service.csproj" />
<ProjectReference Include="..\..\..\services\mix-message-queue\mix.mq\mix.mq.csproj" />
<ProjectReference Include="..\..\mixcore.gateway\mixcore.gateway.csproj" />
<ProjectReference Include="..\..\mixcore\mixcore.csproj" />
</ItemGroup>
Expand Down
36 changes: 35 additions & 1 deletion src/applications/mixcore/Domain/StartupServices.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,48 @@
namespace Mixcore.Domain
using Mix.Lib.Publishers;
using Mix.Lib.Subscribers;
using Mix.Log.Lib.Publishers;
using Mix.Log.Lib.Subscribers;
using Mix.Quartz.Services;
using Mix.RepoDb.Publishers;
using Mix.RepoDb.Subscribers;
using Mix.Shared.Interfaces;
using Mix.Shared.Models.Configurations;
using Mix.Storage.Lib.Subscribers;

namespace Mixcore.Domain
{
public class StartupServices : IStartupService
{
public void AddServices(IServiceCollection services, IConfiguration configuration)
{
var globalConfigs = configuration.GetSection(MixAppSettingsSection.GlobalSettings).Get<GlobalSettingsModel>()!;
services.AddMixRoutes();

services.AddHostedService<MixRepoDbPublisher>();
services.AddHostedService<MixRepoDbSubscriber>();
services.AddHostedService<MixViewModelChangedPublisher>();
services.AddHostedService<MixViewModelChangedSubscriber>();

services.AddHostedService<MixBackgroundTaskPublisher>();
services.AddHostedService<MixBackgroundTaskSubscriber>();
services.AddHostedService<MixDbCommandPublisher>();
services.AddHostedService<MixDbCommandSubscriber>();

services.AddHostedService<MixQuartzHostedService>();
services.AddHostedService<StorageBackgroundTaskSubscriber>();

if (!globalConfigs!.IsInit)
{
services.AddHostedService<MixLogPublisher>();
services.AddHostedService<MixLogSubscriber>();
}

services.AddMixRateLimiter(configuration);
}

public void UseApps(IApplicationBuilder app, IConfiguration configuration, bool isDevelop)
{
app.UseMixRateLimiter();
}

public void UseEndpoints(IEndpointRouteBuilder endpoints, IConfiguration configuration, bool isDevelop)
Expand Down
2 changes: 1 addition & 1 deletion src/applications/mixcore/mixcore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<ItemGroup>
<ProjectReference Include="..\..\services\mix-auth-service\mix.auth.service\mix.auth.service.csproj" />
<ProjectReference Include="..\..\services\mix-message-queue\mix.mq\mix.mq.csproj" />
<ProjectReference Include="..\..\services\mix-message-queue\mix.mq.server\mix.mq.server.csproj" />
<ProjectReference Include="..\mixcore.host.aspire\mixcore.host.aspire.ServiceDefaults\mixcore.host.aspire.ServiceDefaults.csproj" />
<ProjectReference Include="..\..\modules\mix.common\mix.common.csproj" />
<ProjectReference Include="..\..\modules\mix.grpc\mix.grpc.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/modules/mix.grpc/Domain/StartupService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Mix.Grpc.Domain.Services;
using Mix.Lib.Interfaces;
using Mix.Shared.Interfaces;

namespace Mix.Grpc.Domain
{
Expand Down
2 changes: 1 addition & 1 deletion src/modules/mix.log/StartupService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Mix.Lib.Interfaces;
using Mix.Shared.Interfaces;

namespace Mix.Log
{
Expand Down
2 changes: 1 addition & 1 deletion src/modules/mix.messenger/Domain/StartupService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Mix.Lib.Interfaces;
using Mix.Shared.Interfaces;

namespace Mix.Messenger.Domain
{
Expand Down
13 changes: 1 addition & 12 deletions src/modules/mix.portal/Controllers/MixDbController.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
using DocumentFormat.OpenXml.Office2010.Excel;
using DocumentFormat.OpenXml.Office2016.Drawing.ChartDrawing;
using Humanizer;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Azure.Amqp.Framing;
using Mix.Auth.Constants;
using Mix.Database.Constants;
using Mix.Database.Services;
using Mix.Heart.Helpers;
using Mix.Heart.Model;
using Mix.Lib.Interfaces;
using Mix.Lib.ViewModels.ReadOnly;
using Mix.Mq.Lib.Models;
using Mix.Mq.Services;
using Mix.RepoDb.Helpers;
using Mix.RepoDb.Interfaces;
using Mix.RepoDb.Repositories;
Expand All @@ -21,15 +13,12 @@
using Mix.Service.Interfaces;
using Mix.Service.Models;
using Mix.Shared.Models;
using Mix.Shared.Services;
using Mix.SignalR.Enums;
using Mix.SignalR.Hubs;
using Mix.SignalR.Interfaces;
using Mix.SignalR.Models;
using RepoDb;
using RepoDb.Enumerations;
using RepoDb.Interfaces;
using System.Linq.Expressions;

namespace Mix.Portal.Controllers
{
Expand Down
4 changes: 2 additions & 2 deletions src/modules/mix.portal/Domain/StartupService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Mix.Lib.Interfaces;
using Mix.Portal.Domain.Interfaces;
using Mix.Portal.Domain.Interfaces;
using Mix.Portal.Domain.Services;
using Mix.Shared.Interfaces;

namespace Mix.Portal.Domain
{
Expand Down
1 change: 1 addition & 0 deletions src/modules/mix.portal/StartupService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Mix.Lib.Interfaces;
using Mix.Portal.Domain.Interfaces;
using Mix.Portal.Domain.Services;
using Mix.Shared.Interfaces;

namespace Mix.Portal
{
Expand Down
2 changes: 1 addition & 1 deletion src/modules/mix.scheduler/Domain/StartupService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Mix.Lib.Interfaces;
using Mix.Shared.Interfaces;

namespace Mix.Scheduler.Domain
{
Expand Down
2 changes: 1 addition & 1 deletion src/modules/mix.storage/Domain/StartupService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Mix.Lib.Interfaces;
using Mix.Shared.Interfaces;
using Mix.Storage.Lib.Extensions;

namespace Mix.Storage.Domain
Expand Down
1 change: 1 addition & 0 deletions src/modules/mix.tenancy/Domain/StartupService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Mix.Lib.Interfaces;
using Mix.Lib.Services;
using Mix.Shared.Interfaces;
using Mix.Tenancy.Domain.Interfaces;
using Mix.Tenancy.Domain.Services;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Mix.Mq.Lib.Models;
using Mix.Queue.Engines;
using Mix.Queue.Engines.MixQueue;

namespace Mix.Lib.Publishers
{
Expand All @@ -12,8 +12,9 @@ public class MixBackgroundTaskPublisher : PublisherBase
public MixBackgroundTaskPublisher(
IQueueService<MessageQueueModel> queueService,
IConfiguration configuration,
MixEndpointService mixEndpointService)
: base(TopicId, queueService, configuration, mixEndpointService)
MixEndpointService mixEndpointService,
ILogger<MixBackgroundTaskPublisher> logger)
: base(TopicId, queueService, configuration, mixEndpointService, logger)
{
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/platform/mix.library/Publishers/MixDbCommandPublisher.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Mix.Mq.Lib.Models;
using Mix.Queue.Engines;
using Mix.Queue.Engines.MixQueue;

namespace Mix.Lib.Publishers
{
Expand All @@ -12,8 +12,9 @@ public class MixDbCommandPublisher : PublisherBase
public MixDbCommandPublisher(
IQueueService<MessageQueueModel> queueService,
IConfiguration configuration,
MixEndpointService mixEndpointService)
: base(TopicId, queueService, configuration, mixEndpointService)
MixEndpointService mixEndpointService,
ILogger<MixDbCommandPublisher> logger)
: base(TopicId, queueService, configuration, mixEndpointService, logger)
{
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/platform/mix.library/Publishers/MixPublisher.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Mix.Mq.Lib.Models;
using Mix.Queue.Engines;
using Mix.Queue.Engines.MixQueue;
using Mix.RepoDb.Publishers;

namespace Mix.Lib.Publishers
{
Expand All @@ -13,8 +15,9 @@ public class MixPublisher<T> : PublisherBase
public MixPublisher(
IQueueService<MessageQueueModel> queueService,
IConfiguration configuration, IWebHostEnvironment environment,
MixEndpointService mixEndpointService)
: base(topicId, queueService, configuration, mixEndpointService)
MixEndpointService mixEndpointService,
ILogger<MixRepoDbPublisher> logger)
: base(topicId, queueService, configuration, mixEndpointService, logger)
{
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Mix.Mq.Lib.Models;
using Mix.Queue.Engines;
using Mix.Queue.Engines.MixQueue;
using Mix.RepoDb.Publishers;

namespace Mix.Lib.Publishers
{
Expand All @@ -12,8 +14,9 @@ public class MixViewModelChangedPublisher : PublisherBase
public MixViewModelChangedPublisher(
IQueueService<MessageQueueModel> queueService,
IConfiguration configuration,
MixEndpointService mixEndpointService)
: base(TopicId, queueService, configuration, mixEndpointService)
MixEndpointService mixEndpointService,
ILogger<MixViewModelChangedPublisher> logger)
: base(TopicId, queueService, configuration, mixEndpointService, logger)
{
}
}
Expand Down
10 changes: 1 addition & 9 deletions src/platform/mix.library/Startup/MixCommonService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,7 @@ private static IServiceCollection AddMixCommonServices(this IServiceCollection s

services.TryAddScoped<EmailService>();
services.TryAddScoped<IMixEdmService, MixEdmService>();

services.AddHostedService<MixViewModelChangedPublisher>();
services.AddHostedService<MixViewModelChangedSubscriber>();

services.AddHostedService<MixBackgroundTaskPublisher>();
services.AddHostedService<MixBackgroundTaskSubscriber>();
services.AddHostedService<MixDbCommandPublisher>();
services.AddHostedService<MixDbCommandSubscriber>();


MixPermissionService permissionSrv = services.GetService<MixPermissionService>();
permissionSrv.Reload().GetAwaiter().GetResult();
return services;
Expand Down
Loading
Loading