public void Request_Is_Retried()
        {
            // arrange
            var userWriter = new Mock<IUserWriter>();
            var requestQueue = new MockRequestQueue();
            var responseQueue = new MockResponseQueue();
            var controller = new CrawlerController(userWriter.Object, requestQueue, responseQueue, new RecentFriendRegistry());
            var retryRequest = new GetFriendsRequest("test");
            var errorResponse = new ErrorResponse(retryRequest, "fail whale");

            // act
            controller.ProcessResponse(errorResponse);

            // assert
            Assert.That(requestQueue.QueuedMessages, Has.Count(1));
            Assert.That(requestQueue.QueuedMessages.Single(), Is.SameAs(retryRequest));
        }
Beispiel #2
0
 private void ProcessErrorResponse(ErrorResponse response)
 {
     // requeue the work, unless we've already retried this message too many times,
     // in that case, forget it.
     log.Error("ErrorResponse received: " + response, response.Exception);
     log.Error("Retrying Error'd Request: " + response.Request);
     requestQueue.Send(response.Request);
 }