public void SendNotificationOrderCommand(INotificationOrderCommand command) { channel.ExchangeDeclare(RabbitMQConstants.NotificationOrderExchange, ExchangeType.Fanout); channel.QueueDeclare(RabbitMQConstants.NotificationOrderQueue, false, false, false, null); channel.QueueBind(RabbitMQConstants.NotificationOrderQueue, RabbitMQConstants.NotificationOrderExchange, string.Empty); var serializedCommand = JsonConvert.SerializeObject(command); var messageProperties = channel.CreateBasicProperties(); messageProperties.ContentType = RabbitMQConstants.JsonMimeType; channel.BasicPublish(RabbitMQConstants.NotificationOrderExchange, string.Empty, messageProperties, Encoding.UTF8.GetBytes(serializedCommand)); }
public void Consume(INotificationOrderCommand command) { Console.WriteLine($"Notification receivied. Order Id: {command.OrderId}"); }