2023-08-09 16:23:41 +02:00
|
|
|
|
using MassTransit;
|
2023-08-10 10:47:35 +02:00
|
|
|
|
using Server.Packets;
|
|
|
|
|
using Server.Services;
|
2023-08-09 16:23:41 +02:00
|
|
|
|
|
2023-08-10 10:47:35 +02:00
|
|
|
|
namespace Server.Consumers;
|
2023-08-09 16:23:41 +02:00
|
|
|
|
|
2023-08-09 20:14:14 +02:00
|
|
|
|
public class PacketConsumer : IConsumer<RawPacket>
|
2023-08-09 16:23:41 +02:00
|
|
|
|
{
|
|
|
|
|
private readonly PacketDistributorService _distributorService;
|
|
|
|
|
|
|
|
|
|
public PacketConsumer(PacketDistributorService distributorService)
|
|
|
|
|
{
|
|
|
|
|
_distributorService = distributorService;
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-09 20:14:14 +02:00
|
|
|
|
public Task Consume(ConsumeContext<RawPacket> context)
|
2023-08-09 16:23:41 +02:00
|
|
|
|
{
|
2023-08-09 20:14:14 +02:00
|
|
|
|
_distributorService.AddPacket(context.Message);
|
|
|
|
|
return Task.CompletedTask;
|
2023-08-09 16:23:41 +02:00
|
|
|
|
}
|
|
|
|
|
}
|