проблема в том, что мой потребитель не может десериализовать сообщения, я использую этот код в моем Потребителе, и моя проблема исправлена
protected override Task ExecuteAsync(CancellationToken stoppingToken)
{
stoppingToken.ThrowIfCancellationRequested();
var consumer = new EventingBasicConsumer(_channel);
consumer.Received += HandleMessageAsync; ;
_channel.BasicConsume("BlaBlaBlaQueue", false, consumer);
return Task.CompletedTask;
}
private async void HandleMessageAsync(object sender, BasicDeliverEventArgs e)
{
var content = System.Text.Encoding.UTF8.GetString(e.Body);
ConfirmRequest confirmRequest = JsonConvert.DeserializeObject<ConfirmRequest>(content);
var result =await sendConfirmBlaBlaBlaResuest.ConfirmBlaBlaBlaAsync(new BlaBlaBlaDto {});
var responce = new ConfirmBlaBlaBlaResponceEvent(confirmRequest);
if (result.IsFailure)
{
responce.Message = result.Error;
responce.IsSuccess = false;
}
else
{
responce.IsSuccess = true;
}
await bus.PublishBlaBlaBlaResponceEventAsync(responce);
_channel.BasicAck(e.DeliveryTag, false);
}
, а мой производитель -
public async Task PublishBlaBlaBlaEventAsync(BlaBlaBlaEvent myEvent)
{
var exchange = _bus.ExchangeDeclare(rabbitOptions.BlaBlaBlaExchangeName, ExchangeType.Topic);
var queue = _bus.QueueDeclare(rabbitOptions.BlaBlaBlaQueueName);
_bus.Bind(exchange, queue, "#");
var message = new Message<BlaBlaBlaEvent>(myEvent);
await _bus.PublishAsync(exchange, queue.Name, false, message);
}