private async Task SendOrderRejectedEventAsync(Guid processingUserId, Guid anotherUserId, Guid dealId, Guid orderId, string description) { var @event = new OrderRejectedEvent { ProcessingUserId = processingUserId, AnotherUserId = anotherUserId, DealId = dealId, OrderId = orderId, Description = description }; _messageSession = (IMessageSession)_serviceProvider.GetService(typeof(IMessageSession)); await _messageSession.Publish(@event); _logger.LogInformation("----- Published OrderRejectedEvent: {IntegrationEventId} from {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event); }
/// <summary> /// Pubblica l'evento "Ordine Rifiutato da gestore" su coda Payment e User /// </summary> /// <param name="orderRejected">Dati del messaggio</param> public void OrderRejected(OrderRejectedEvent orderRejected) { IBasicProperties props = _channel.CreateBasicProperties(); props.Type = nameof(OrderRejectedEvent); var body = MessageSerializationHelper.SerializeObjectToBin(orderRejected); _channel.BasicPublish(exchange: string.Empty, routingKey: ApplicationEvents.PaymentQueue, basicProperties: props, body: body); _channel.BasicPublish(exchange: string.Empty, routingKey: ApplicationEvents.UserQueue, basicProperties: props, body: body); }
private void When(OrderRejectedEvent evt) { Status = OrderStatus.Rejected; }