continuity/Server/Consumers/PacketConsumer.cs

19 lines
489 B
C#
Raw Normal View History

2023-10-12 09:15:34 +02:00
namespace Server.Consumers;
2023-08-09 16:23:41 +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
{
private readonly PacketDistributorService distributorService;
2023-08-09 16:23:41 +02: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
{
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
}