29 lines
1.1 KiB
C#
29 lines
1.1 KiB
C#
using FictionArchive.Service.Shared.MassTransit.Contracts.Commands;
|
|
using MassTransit;
|
|
|
|
namespace FictionArchive.Service.NovelService.Services.Consumers;
|
|
|
|
public class PullChapterContentCommandConsumer : IConsumer<PullChapterContentCommand>
|
|
{
|
|
private readonly ILogger<PullChapterContentCommandConsumer> _logger;
|
|
private readonly NovelUpdateService _novelUpdateService;
|
|
|
|
public PullChapterContentCommandConsumer(
|
|
ILogger<PullChapterContentCommandConsumer> logger,
|
|
NovelUpdateService novelUpdateService)
|
|
{
|
|
_logger = logger;
|
|
_novelUpdateService = novelUpdateService;
|
|
}
|
|
|
|
public async Task Consume(ConsumeContext<PullChapterContentCommand> context)
|
|
{
|
|
var command = context.Message;
|
|
_logger.LogInformation(
|
|
"Processing PullChapterContentCommand for Novel: {NovelId}, Volume: {VolumeId}, Chapter: {ChapterOrder}",
|
|
command.NovelId, command.VolumeId, command.ChapterOrder);
|
|
|
|
await _novelUpdateService.PullChapterContents(command.NovelId, command.VolumeId, command.ChapterOrder);
|
|
}
|
|
}
|