some changes
This commit is contained in:
parent
4ec9720541
commit
b47bac67ca
37 changed files with 397 additions and 190 deletions
22
Femto.Modules.Blog/Infrastructure/OutboxMessageHandler.cs
Normal file
22
Femto.Modules.Blog/Infrastructure/OutboxMessageHandler.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using Femto.Common.Infrastructure.Outbox;
|
||||
using Femto.Common.Integration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Femto.Modules.Blog.Infrastructure;
|
||||
|
||||
public class OutboxMessageHandler(IEventPublisher publisher, ILogger<OutboxMessageHandler> logger) : IOutboxMessageHandler
|
||||
{
|
||||
public async Task HandleMessage<TNotification>(
|
||||
TNotification notification,
|
||||
CancellationToken executionContextCancellationToken
|
||||
)
|
||||
{
|
||||
if (notification is IEvent evt)
|
||||
{
|
||||
await publisher.Publish(evt);
|
||||
} else
|
||||
{
|
||||
logger.LogWarning("ignoring non IEvent {Type} in outbox message handler", typeof(TNotification));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue