feat(security): complete capability messaging workflows

This commit is contained in:
2026-07-29 11:21:15 +08:00
parent df88fa19cb
commit 5c4de4b282
35 changed files with 19544 additions and 89 deletions

View File

@@ -37,6 +37,9 @@ builder.Services.AddOptions<MessagingOptions>()
!string.IsNullOrWhiteSpace(options.Username) &&
!string.IsNullOrWhiteSpace(options.Password)),
"Production RabbitMQ requires a valid Host, Username and Password.")
.Validate(
options => options.OutboxBacklogAlertCount > 0 && options.OutboxOldestMessageAlertSeconds > 0,
"RabbitMQ outbox alert thresholds must be positive.")
.ValidateOnStart();
if (messaging.IsConfigured)
{

View File

@@ -2,12 +2,14 @@ using Microsoft.Extensions.Options;
using Tiku.Application.Jobs;
using Tiku.Application.Security;
using Tiku.Application.Tenancy;
using Tiku.Infrastructure.Messaging;
namespace Tiku.Worker;
public class Worker(
IServiceScopeFactory scopeFactory,
IOptions<DomainLifecycleOptions> options,
MessagingOptions messagingOptions,
ILogger<Worker> logger) : BackgroundService
{
private readonly string workerId = $"{Environment.MachineName}:{Guid.NewGuid():N}";
@@ -60,6 +62,10 @@ public class Worker(
.InitializeSystem(null, "Background job lease worker");
return await scope.ServiceProvider
.GetRequiredService<IBackgroundJobService>()
.ProcessPendingAsync(workerId, 20, stoppingToken);
.ProcessPendingAsync(
workerId,
20,
includeImmediateJobs: !messagingOptions.IsConfigured,
cancellationToken: stoppingToken);
}
}

View File

@@ -3,7 +3,9 @@
"Host": "",
"VirtualHost": "/",
"Username": "",
"Password": ""
"Password": "",
"OutboxBacklogAlertCount": 1000,
"OutboxOldestMessageAlertSeconds": 300
},
"TenantDomains": {
"Enabled": true,