2023-10-12 07:15:34 +00:00
|
|
|
namespace Server.Consumers;
|
2023-08-09 14:23:41 +00:00
|
|
|
|
2023-08-12 21:02:59 +00:00
|
|
|
using MassTransit;
|
|
|
|
using Packets;
|
|
|
|
using Services;
|
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-11-01 17:18:27 +00:00
|
|
|
private readonly PacketDistributorService _distributorService;
|
2023-08-09 14:23:41 +00:00
|
|
|
|
2023-11-01 17:18:27 +00:00
|
|
|
public PacketConsumer(PacketDistributorService distributorService) => this._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-01 17:18:27 +00:00
|
|
|
this._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
|
|
|
}
|