Пример #1
0
 public void StartConsumingMessage(SagaCommandContext context)
 {
     using (var channel = _channelFactory.CreateChannel())
     {
         var consumer = new EventingBasicConsumer(channel);
         consumer.Received += (sender, args) =>
         {
         };
         channel.BasicConsume(context.ReplyAddress, false, context.Host, consumer);
     }
 }
Пример #2
0
 public void Publish(SagaCommandContext context, byte[] data)
 {
     using (var channel = _channelFactory.CreateChannel())
     {
         channel.ExchangeDeclare(context.MessageType, "direct", true, false, null);
         channel.QueueDeclare(context.DestinationAddress, true, false, false, null);
         channel.QueueDeclare(context.ReplyAddress, true, false, false, null);
         channel.QueueDeclare(context.FaultAddress, true, false, false, null);
         channel.QueueBind(context.DestinationAddress, context.MessageType, "", null);
         channel.BasicPublish(context.MessageType, "", true, new BasicProperties()
         {
             Headers    = context.ToDictionary(),
             Persistent = true,
         }, data);
         // we start to consume message on reply queue.
         StartConsumingMessage(context);
     }
 }
Пример #3
0
 public void Publish(SagaCommandContext context, byte[] data)
 {
     _rabbitMqBus.Publish(context, data);
 }