using System.Text; using JOBot.Infrastructure.Config; using JOBot.TClient.Services; using RabbitMQ.Client; using RabbitMQ.Client.Events; namespace JOBot.TClient.Queues; public class AuthQueue { private readonly PrepareUserService _prepareUserService; public AuthQueue( IChannel channel, PrepareUserService prepareUserService) { _prepareUserService = prepareUserService; var consumer = new AsyncEventingBasicConsumer(channel); consumer.ReceivedAsync += OnDataReceivedAsync; channel.BasicConsumeAsync(RabbitQueues.AuthQueue, autoAck: true, consumer: consumer); } private async Task OnDataReceivedAsync(object sender, BasicDeliverEventArgs eventArgs) { await _prepareUserService.SelectCv(Convert.ToInt64(Encoding.UTF8.GetString(eventArgs.Body.ToArray()))); } }