/// <summary>
        /// For all configured messages type (handlers, consumers, and sagas), configures message retry using the retry configuration specified.
        /// Retry is configured once for each message type, and is added prior to the consumer factory or saga repository in the pipeline.
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="configure"></param>
        public static void UseMessageRetry(this IConsumePipeConfigurator configurator, Action <IRetryConfigurator> configure)
        {
            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }

            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            var observer = new MessageRetryConfigurationObserver(configurator, CancellationToken.None, configure);
        }
        /// <summary>
        /// For all configured messages type (handlers, consumers, and sagas), configures message retry using the retry configuration specified.
        /// Retry is configured once for each message type, and is added prior to the consumer factory or saga repository in the pipeline.
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="connector">
        /// The bus factory configurator, to connect the observer, to cancel retries if the bus is stopped
        /// </param>
        /// <param name="configure"></param>
        public static void UseMessageRetry(this IConsumePipeConfigurator configurator, IBusFactoryConfigurator connector,
                                           Action <IRetryConfigurator> configure)
        {
            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }

            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            var retryObserver = new RetryBusObserver();

            connector.ConnectBusObserver(retryObserver);

            var observer = new MessageRetryConfigurationObserver(configurator, retryObserver.Stopping, configure);
        }