public async Task Complete_Completes() { var now = clock.Object.UtcNow; var context = new SubscribedContext { MessageData = new SubscribedMessage { Id = 12345, NotBefore = now, }, }; await reader.Complete(context); Assert.IsTrue(ReferenceEquals(context.MessageData, CompletedMessage)); Assert.AreEqual(now, context.MessageData.Completed); }
public async Task Fail_UpdatesMessage() { var expectedRetries = (byte)(reader.MaxRetries - 1); var context = new SubscribedContext { MessageData = new SubscribedMessage { Retries = (byte)(reader.MaxRetries - 2), }, Headers = new Headers { } }; await reader.Fail(context, new ApplicationException()); Assert.AreEqual(expectedRetries, context.MessageData.Retries); Assert.IsTrue(context.MessageData.NotBefore >= clock.Object.UtcNow.AddSeconds(5)); // Assert.IsFalse(string.IsNullOrWhiteSpace(context.Headers.ExceptionDetails)); counters.Verify(c => c.RetryMessage(), Times.Once); dataAccess.Verify(c => c.Update(It.IsAny <SubscribedMessage>()), Times.Once); Assert.IsTrue(ReferenceEquals(context.MessageData, UpdatedMessage)); }
public Task Handle(SubscribedContext context, AnnounceSagaCompleted message) { // nothing fancy, just note that we handled the subscribed message. _log.Info($"Subscriber {context.SubscriberId} got Saga complete announcement {message.AppId}"); return(Task.CompletedTask); }