continuity/Server/Consumers/PacketConsumer.cs

19 lines
460 B
C#
Raw Normal View History

2023-08-09 14:23:41 +00:00
using MassTransit;
namespace Server;
2023-08-09 18:14:14 +00:00
public class PacketConsumer : IConsumer<RawPacket>
2023-08-09 14:23:41 +00:00
{
private readonly PacketDistributorService _distributorService;
public PacketConsumer(PacketDistributorService distributorService)
{
_distributorService = distributorService;
}
2023-08-09 18:14:14 +00:00
public Task Consume(ConsumeContext<RawPacket> context)
2023-08-09 14:23:41 +00:00
{
2023-08-09 18:14:14 +00:00
_distributorService.AddPacket(context.Message);
return Task.CompletedTask;
2023-08-09 14:23:41 +00:00
}
}