server-master/srcs/_plugins/Plugin.MongoLogs/Utils/GenericLogConsumer.cs
2026-02-10 18:21:30 +01:00

21 lines
No EOL
732 B
C#

using System.Threading;
using System.Threading.Tasks;
using PhoenixLib.ServiceBus;
using Plugin.MongoLogs.Services;
using Plugin.PlayerLogs;
namespace Plugin.MongoLogs.Utils
{
public class GenericLogConsumer<T> : IMessageConsumer<T> where T : IPlayerActionLogMessage
{
private readonly MongoLogsBackgroundService _mongoLogsBackgroundService;
public GenericLogConsumer(MongoLogsBackgroundService mongoLogsBackgroundService) => _mongoLogsBackgroundService = mongoLogsBackgroundService;
public Task HandleAsync(T notification, CancellationToken token)
{
_mongoLogsBackgroundService.AddLogsToInsertionQueue(notification);
return Task.CompletedTask;
}
}
}