You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Tiobon.Web.Core/Tiobon.Core.Extensions/EventHandling/BlogQueryIntegrationEventHa...

33 lines
1.3 KiB

using Tiobon.Core.Common;
using Tiobon.Core.EventBus.EventHandling;
using Tiobon.Core.IServices;
using Microsoft.Extensions.Logging;
using System;
using System.Threading.Tasks;
namespace Tiobon.Core.EventBus
{
public class TiobonQueryIntegrationEventHandler : IIntegrationEventHandler<TiobonQueryIntegrationEvent>
{
private readonly ITiobonArticleServices _TiobonArticleServices;
private readonly ILogger<TiobonQueryIntegrationEventHandler> _logger;
public TiobonQueryIntegrationEventHandler(
ITiobonArticleServices TiobonArticleServices,
ILogger<TiobonQueryIntegrationEventHandler> logger)
{
_TiobonArticleServices = TiobonArticleServices;
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}
public async Task Handle(TiobonQueryIntegrationEvent @event)
{
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, "Tiobon.Core", @event);
ConsoleHelper.WriteSuccessLine($"----- Handling integration event: {@event.Id} at Tiobon.Core - ({@event})");
await _TiobonArticleServices.QueryById(@event.TiobonId.ToString());
}
}
}