public static void UseRetry(this IPipeConfigurator <ConsumeContext> configurator, IRetryPolicy retryPolicy)
        {
            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }

            var pipeBuilderConfigurator = new RetryPipeSpecification(retryPolicy);

            configurator.AddPipeSpecification(pipeBuilderConfigurator);
        }
        public static void UseRetry <T>(this IPipeConfigurator <T> configurator, Action <IRetryConfigurator> configure)
            where T : class, PipeContext
        {
            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }

            var specification = new RetryPipeSpecification <T>();

            configure?.Invoke(specification);

            configurator.AddPipeSpecification(specification);
        }
        /// <summary>
        /// Retry the subsequent filter pipe using the specified retry policy
        /// </summary>
        /// <param name="configurator">The pipe configurator</param>
        /// <param name="retryPolicy">The retry policy</param>
        /// <param name="cancellationToken">The cancellation token to end the retry operations</param>
        public static void UseRetry(this IPipeConfigurator <ConsumeContext> configurator, IRetryPolicy retryPolicy, CancellationToken cancellationToken)
        {
            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }
            if (retryPolicy == null)
            {
                throw new ArgumentNullException(nameof(retryPolicy));
            }

            retryPolicy = new CancelRetryPolicy(retryPolicy, cancellationToken);

            var pipeBuilderConfigurator = new RetryPipeSpecification(retryPolicy);

            configurator.AddPipeSpecification(pipeBuilderConfigurator);
        }