public void Stop()
 {
     if (_consumer != null)
     {
         _consumer.Received -= ProcessMessage;
     }
     if (_channel?.IsOpen == true)
     {
         _channel.BasicCancel(_consumerTag);
     }
 }
Пример #2
0
 public static void Cancel(RC.IModel channel, string consumerTag, ILogger logger = null)
 {
     try
     {
         channel.BasicCancel(consumerTag);
     }
     catch (AlreadyClosedException e)
     {
         logger?.LogTrace(e, "{channel} is already closed", channel);
     }
     catch (Exception e)
     {
         logger?.LogDebug(e, "Error performing 'basicCancel' on {channel}", channel);
     }
 }