continuity/Continuity.AuthServer/Consumers/PacketConsumer.cs

26 lines
786 B
C#
Raw Normal View History

2023-11-21 21:37:50 +01:00
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
2023-11-20 19:58:30 +01:00
using Continuity.AuthServer.Packets;
using MassTransit;
using NetCoreServer;
using Rai.PacketMediator;
using Wonderking.Packets;
2023-11-19 17:07:28 +01:00
namespace Continuity.AuthServer.Consumers;
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<OperationCode, TcpSession> _distributorService;
2023-08-09 16:23:41 +02:00
public PacketConsumer(PacketDistributorService<OperationCode, TcpSession> distributorService)
2023-11-19 17:07:28 +01:00
{
_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
{
2024-02-05 09:02:27 +01:00
return _distributorService.AddPacketAsync(context.Message.MessageBody, context.Message.OperationCode,
context.Message.Session);
2023-08-09 16:23:41 +02:00
}
2023-08-11 11:31:30 +02:00
}