public Endpoint([NotNull] IEndpointAddress address, [NotNull] IMessageSerializer serializer, [NotNull] IDuplexTransport transport, [NotNull] IOutboundTransport errorTransport) { if (address == null) { throw new ArgumentNullException("address"); } if (serializer == null) { throw new ArgumentNullException("serializer"); } if (transport == null) { throw new ArgumentNullException("transport"); } if (errorTransport == null) { throw new ArgumentNullException("errorTransport"); } _address = address; _transport = transport; _errorTransport = errorTransport; _serializer = serializer; _tracker = new MessageRetryTracker(5); SetDisposedMessage(); }
public Endpoint(IEndpointAddress address, IMessageSerializer serializer, IDuplexTransport transport, IOutboundTransport errorTransport) { _address = address; _transport = transport; _errorTransport = errorTransport; _serializer = serializer; _tracker = new MessageRetryTracker(5); SetDisposedMessage(); }
public void IsLimitExceeded_return_false_untill_specified_limit_reached() { const int retryLimit = 5; var tracker = new MessageRetryTracker(retryLimit); const string id = "qelofjsw"; for (int i = 0; i < retryLimit; i++) { Assert.IsFalse(tracker.IsRetryLimitExceeded(id)); tracker.IncrementRetryCount(id); } Assert.IsTrue(tracker.IsRetryLimitExceeded(id)); }
public void Should_return_false_until_the_limit_is_exceeded() { const int retryLimit = 5; var tracker = new MessageRetryTracker(retryLimit); const string id = "qelofjsw"; Exception ex; for (int i = 0; i < retryLimit; i++) { Assert.IsFalse(tracker.IsRetryLimitExceeded(id, out ex)); tracker.IncrementRetryCount(id, ex); } Assert.IsTrue(tracker.IsRetryLimitExceeded(id, out ex)); }
public void Should_reset_once_the_message_was_received() { const int retryLimit = 5; var tracker = new MessageRetryTracker(retryLimit); const string id = "qelofjsw"; Assert.IsFalse(tracker.IsRetryLimitExceeded(id)); tracker.IncrementRetryCount(id); tracker.MessageWasReceivedSuccessfully(id); for (int i = 0; i < retryLimit; i++) { Assert.IsFalse(tracker.IsRetryLimitExceeded(id)); tracker.IncrementRetryCount(id); } Assert.IsTrue(tracker.IsRetryLimitExceeded(id)); }