/// <summary> /// Pubblica l'evento "Presa in consegna da rider" su coda Order /// </summary> /// <param name="deliveryPickedUp">Dati del messaggio</param> public void DeliveryPickedUp(DeliveryPickedUpEvent deliveryPickedUp) { IBasicProperties props = _channel.CreateBasicProperties(); props.Type = nameof(DeliveryPickedUpEvent); var body = MessageSerializationHelper.SerializeObjectToBin(deliveryPickedUp); _channel.BasicPublish(exchange: string.Empty, routingKey: ApplicationEvents.OrderQueue, basicProperties: props, body: body); }
/// <summary> /// Pubblica l'evento "Presa in consegna da rider" su coda Order /// </summary> /// <param name="deliveryPickedUp">Dati del messaggio</param> public void DeliveryPickedUp(DeliveryPickedUpEvent deliveryPickedUp) { using (var connection = _factory.CreateConnection()) using (var channel = connection.CreateModel()) { IBasicProperties props = channel.CreateBasicProperties(); props.Type = nameof(DeliveryPickedUpEvent); var body = MessageSerializationHelper.SerializeObjectToBin(deliveryPickedUp); channel.BasicPublish(exchange: string.Empty, routingKey: ApplicationEvents.OrderQueue, basicProperties: props, body: body); } }