2023-10-12 09:15:34 +02:00
|
|
|
namespace Server.Consumers;
|
2023-08-09 16:23:41 +02:00
|
|
|
|
2023-08-12 23:02:59 +02:00
|
|
|
using MassTransit;
|
|
|
|
using Packets;
|
|
|
|
using Services;
|
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
|
|
|
{
|
2023-11-01 18:18:27 +01:00
|
|
|
private readonly PacketDistributorService _distributorService;
|
2023-08-09 16:23:41 +02:00
|
|
|
|
2023-11-01 18:18:27 +01:00
|
|
|
public PacketConsumer(PacketDistributorService distributorService) => this._distributorService = distributorService;
|
2023-08-09 16:23:41 +02:00
|
|
|
|
2023-08-09 20:14:14 +02:00
|
|
|
public Task Consume(ConsumeContext<RawPacket> context)
|
2023-08-09 16:23:41 +02:00
|
|
|
{
|
2023-11-01 18:18:27 +01:00
|
|
|
this._distributorService.AddPacket(context.Message);
|
2023-08-09 20:14:14 +02:00
|
|
|
return Task.CompletedTask;
|
2023-08-09 16:23:41 +02:00
|
|
|
}
|
2023-08-11 11:31:30 +02:00
|
|
|
}
|