[FA-4] Adds an event bus infrastructure, a RabbitMQ implementation and rewires existing mutations on NovelService to utilize it.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using FictionArchive.Service.NovelService.Models.IntegrationEvents;
|
||||
using FictionArchive.Service.Shared.Services.EventBus;
|
||||
|
||||
namespace FictionArchive.Service.NovelService.Services.EventHandlers;
|
||||
|
||||
public class NovelUpdateRequestedEventHandler : IIntegrationEventHandler<NovelUpdateRequestedEvent>
|
||||
{
|
||||
private readonly ILogger<NovelUpdateRequestedEventHandler> _logger;
|
||||
private readonly IEventBus _eventBus;
|
||||
private readonly NovelUpdateService _novelUpdateService;
|
||||
|
||||
public NovelUpdateRequestedEventHandler(ILogger<NovelUpdateRequestedEventHandler> logger, IEventBus eventBus, NovelUpdateService novelUpdateService)
|
||||
{
|
||||
_logger = logger;
|
||||
_eventBus = eventBus;
|
||||
_novelUpdateService = novelUpdateService;
|
||||
}
|
||||
|
||||
public async Task Handle(NovelUpdateRequestedEvent @event)
|
||||
{
|
||||
await _novelUpdateService.ImportNovel(@event.NovelUrl);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user