internal bool Retry(Action send) { var policy = PolicyRegistry.Get <Policy>(CommandProcessor.RETRYPOLICY); var result = policy.ExecuteAndCapture(send); if (result.Outcome != OutcomeType.Successful) { if (result.FinalException != null) { s_logger.LogError(result.FinalException, "Exception whilst trying to publish message"); CheckOutstandingMessages(); } return(false); } return(true); }
private async Task <bool> RetryAsync(Func <CancellationToken, Task> send, bool continueOnCapturedContext = false, CancellationToken cancellationToken = default(CancellationToken)) { var result = await PolicyRegistry.Get <AsyncPolicy>(CommandProcessor.RETRYPOLICYASYNC) .ExecuteAndCaptureAsync(send, cancellationToken, continueOnCapturedContext) .ConfigureAwait(continueOnCapturedContext); if (result.Outcome != OutcomeType.Successful) { if (result.FinalException != null) { s_logger.LogError(result.FinalException, "Exception whilst trying to publish message"); CheckOutstandingMessages(); } return(false); } return(true); }