示例#1
0
 public async Task DoesNotLoadAnythingInitially()
 {
     using (var result = await _timeoutManager.GetDueMessages())
     {
         Assert.That(result.Count(), Is.EqualTo(0));
     }
 }
        async Task TimerElapsed()
        {
            using (var result = await _timeoutManager.GetDueMessages())
            {
                foreach (var dueMessage in result)
                {
                    var transportMessage = dueMessage.ToTransportMessage();
                    var returnAddress    = transportMessage.Headers[Headers.DeferredRecipient];

                    _log.Debug("Sending due message {messageLabel} to {queueName}",
                               transportMessage.GetMessageLabel(),
                               returnAddress);

                    using (var context = new TransactionContext())
                    {
                        await _transport.Send(returnAddress, transportMessage, context);

                        await context.Complete();
                    }

                    await dueMessage.MarkAsCompleted();
                }

                await result.Complete();
            }
        }
        async Task TimerElapsed()
        {
            using (var result = await _timeoutManager.GetDueMessages())
            {
                foreach (var dueMessage in result)
                {
                    var transportMessage = dueMessage.ToTransportMessage();
                    var returnAddress    = transportMessage.Headers[Headers.DeferredRecipient];

                    _log.Debug("Sending due message {0} to {1}",
                               transportMessage.Headers[Headers.MessageId],
                               returnAddress);

                    Console.WriteLine("Sending due message {0} to {1}",
                                      transportMessage.Headers[Headers.MessageId],
                                      returnAddress);

                    using (var context = new DefaultTransactionContext())
                    {
                        await _transport.Send(returnAddress, transportMessage, context);

                        await context.Complete();
                    }

                    dueMessage.MarkAsCompleted();
                }
            }
        }