public virtual async Task <Guid> ProcessPaymentAsync(PaymentDto dto) { dto.Id = Guid.NewGuid(); string paymentSerialized = JsonSerializer.Serialize(dto); _logger.LogInformation($"Sending payment with id {dto.Id} to messaging service."); await _messagingService.SendMessageAsync(paymentSerialized, "payment_queue"); return(dto.Id); }
public async Task Handle(PaymentAcceptedEvent notification, CancellationToken cancellationToken) { try { var response = new PaymentResponse(notification.AggregateId, "APPROVED"); await _rabbitMqPublisher.SendMessageAsync(JsonSerializer.Serialize(response), "response_queue"); } catch (Exception e) { _logger.LogError(e, "Error occured while trying to payment response to rabbitmq."); } }