refactor(architecture): enforce module boundaries
This commit is contained in:
@@ -35,12 +35,16 @@ public sealed record BackgroundJobItem(
|
||||
Guid? OutputAssetId,
|
||||
JsonElement Result);
|
||||
|
||||
public interface IBackgroundJobService
|
||||
public interface IBackgroundJobQueue
|
||||
{
|
||||
Task<BackgroundJobItem> EnqueueAsync(
|
||||
CreateBackgroundJobCommand command,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
}
|
||||
|
||||
public interface IBackgroundJobProcessor
|
||||
{
|
||||
Task<int> ProcessPendingAsync(
|
||||
string workerId,
|
||||
int batchSize,
|
||||
@@ -54,6 +58,10 @@ public interface IBackgroundJobService
|
||||
string workerId,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
}
|
||||
|
||||
public interface IBackgroundJobOperations
|
||||
{
|
||||
Task<IReadOnlyCollection<BackgroundJobItem>> ListAsync(
|
||||
Guid tenantId,
|
||||
string? jobType = null,
|
||||
@@ -85,3 +93,23 @@ public interface IBackgroundJobService
|
||||
Guid actorUserId,
|
||||
CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
||||
public interface IBackgroundJobService :
|
||||
IBackgroundJobQueue,
|
||||
IBackgroundJobProcessor,
|
||||
IBackgroundJobOperations;
|
||||
|
||||
public sealed record BackgroundJobExecutionContext(
|
||||
Guid JobId,
|
||||
Guid TenantId,
|
||||
string JobType,
|
||||
JsonElement Payload);
|
||||
|
||||
public interface IBackgroundJobHandler
|
||||
{
|
||||
string JobType { get; }
|
||||
|
||||
Task<JsonElement> HandleAsync(
|
||||
BackgroundJobExecutionContext context,
|
||||
CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user