implement message subscribing and worker

This commit is contained in:
2026-02-14 19:17:05 +01:00
parent 4cdfa1e096
commit 0dadaf1280
19 changed files with 376 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
using AipsCore.Application.Abstract.Command;
using AipsCore.Application.Abstract.MessageBroking;
using AipsCore.Application.Abstract.Query;
namespace AipsCore.Application.Abstract;
@@ -9,4 +10,6 @@ public interface IDispatcher
Task<TResult> Execute<TResult>(ICommand<TResult> command, CancellationToken cancellationToken = default);
Task<TResult> Execute<TResult>(IQuery<TResult> query, CancellationToken cancellationToken = default);
public Task Execute(IMessage message, CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,3 @@
namespace AipsCore.Application.Abstract.MessageBroking;
public interface IMessage;

View File

@@ -0,0 +1,6 @@
namespace AipsCore.Application.Abstract.MessageBroking;
public interface IMessageHandler<TMessage> where TMessage : IMessage
{
Task Handle(TMessage message, CancellationToken cancellationToken);
}

View File

@@ -0,0 +1,8 @@
namespace AipsCore.Application.Abstract.MessageBroking;
public interface IMessageSubscriber
{
Task SubscribeAsync<T>(
Func<T, CancellationToken, Task> handler
);
}

View File

@@ -0,0 +1,7 @@
namespace AipsCore.Application.Abstract.MessageBroking;
public enum MessageTag
{
Worker,
RT
}