Exemple #1
0
 private async void OnReceived(object s, BasicDeliverEventArgs e)
 {
     try
     {
         var message = new RabbitReceiverMessage(e, Channel, AutoAck);
         await MessageHandler.OnMessageReceivedAsync(this, message).ConfigureAwait(false);
     }
     catch (Exception ex)
     {
         OnError("Error in message handler.", ex);
     }
 }
Exemple #2
0
        private async void OnReceived(object?s, BasicDeliverEventArgs e)
        {
            try
            {
                using var message = new RabbitReceiverMessage(e, Channel, AutoAck);
                await MessageHandler !.OnMessageReceivedAsync(this, message).ConfigureAwait(false);
            }
            // We'd love to do better exception handling here, but...
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception ex)
#pragma warning restore CA1031 // Do not catch general exception types
            {
                OnError("Error in message handler.", ex);
            }
        }