23 lines
595 B
C#
23 lines
595 B
C#
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
|
|
|
using MassTransit;
|
|
using Server.Packets;
|
|
using Server.Services;
|
|
|
|
namespace Server.Consumers;
|
|
|
|
public class PacketConsumer : IConsumer<RawPacket>
|
|
{
|
|
private readonly PacketDistributorService _distributorService;
|
|
|
|
public PacketConsumer(PacketDistributorService distributorService)
|
|
{
|
|
_distributorService = distributorService;
|
|
}
|
|
|
|
public Task Consume(ConsumeContext<RawPacket> context)
|
|
{
|
|
_distributorService.AddPacket(context.Message);
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|