2023-11-21 20:37:50 +00:00
|
|
|
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
2023-11-20 18:58:30 +00:00
|
|
|
|
2024-01-29 07:39:18 +00:00
|
|
|
using Continuity.AuthServer.Packets;
|
|
|
|
using Continuity.AuthServer.Services;
|
2023-08-12 21:02:59 +00:00
|
|
|
using MassTransit;
|
2023-11-19 16:07:28 +00:00
|
|
|
|
2024-01-29 07:39:18 +00:00
|
|
|
namespace Continuity.AuthServer.Consumers;
|
2023-08-09 14:23:41 +00:00
|
|
|
|
2023-08-09 18:14:14 +00:00
|
|
|
public class PacketConsumer : IConsumer<RawPacket>
|
2023-08-09 14:23:41 +00:00
|
|
|
{
|
2023-10-27 17:47:17 +00:00
|
|
|
private readonly PacketDistributorService _distributorService;
|
2023-08-09 14:23:41 +00:00
|
|
|
|
2023-11-19 16:07:28 +00:00
|
|
|
public PacketConsumer(PacketDistributorService distributorService)
|
|
|
|
{
|
|
|
|
_distributorService = distributorService;
|
|
|
|
}
|
2023-08-09 14:23:41 +00:00
|
|
|
|
2023-08-09 18:14:14 +00:00
|
|
|
public Task Consume(ConsumeContext<RawPacket> context)
|
2023-08-09 14:23:41 +00:00
|
|
|
{
|
2023-11-19 16:07:28 +00:00
|
|
|
_distributorService.AddPacket(context.Message);
|
2023-08-09 18:14:14 +00:00
|
|
|
return Task.CompletedTask;
|
2023-08-09 14:23:41 +00:00
|
|
|
}
|
2023-08-11 09:31:30 +00:00
|
|
|
}
|