public void Failure(DeliveredRabbitMessage message, Exception exception)
 {
     if (_log.IsErrorEnabled)
     {
         _log.Error(string.Format("Failure while processing message '{0}'.", message), exception);
     }
     _messageSource.Failure(message, exception);
 }
 public void Cancel(DeliveredRabbitMessage message)
 {
     if (_log.IsDebugEnabled)
     {
         _log.Debug(string.Format("Canceling message processing with delivery tag '{0}'", message.DeliveryTag));
     }
     _messageSource.Cancel(message);
 }
 public void Acknowledge(DeliveredRabbitMessage message)
 {
     if (_log.IsDebugEnabled)
     {
         _log.Debug(string.Format("Acknowledging message with delivery tag '{0}'", message.DeliveryTag));
     }
     _messageSource.Acknowledge(message);
 }
 public bool TryGetNextMessage(out DeliveredRabbitMessage message)
 {
     var result = _messageSource.TryGetNextMessage(out message);
     if (result && _log.IsDebugEnabled)
     {
         _log.Debug(string.Format("Recieved message with Delivery tag '{0}': {1}", message.DeliveryTag, message));
     }
     return result;
 }
        public override async Task HandleMessage(DeliveredRabbitMessage message, CancellationToken cancellationToken)
        {
            using (var smtpClient = new SmtpClient(MailHost))
            using (var mail = new MailMessage())
            {
                mail.From = new MailAddress("*****@*****.**");
                mail.To.Add(new MailAddress("*****@*****.**"));
                mail.Subject = "Test " + Encoding.UTF8.GetString(message.Body);
                smtpClient.Send(mail);
            }

            await Task.Delay(TimeSpan.FromSeconds(2), cancellationToken);
        }
 public async Task HandleMessage(DeliveredRabbitMessage message, CancellationToken cancellationToken)
 {
     LastMessage = message;
 }
 public abstract Task HandleMessage(DeliveredRabbitMessage message, CancellationToken cancellationToken);