/// <summary> /// Configures the message retry for the consumer consumer, regardless of message type. /// </summary> /// <param name="configurator"></param> /// <param name="configure"></param> public static void UseMessageRetry <TConsumer>(this IConsumerConfigurator <TConsumer> configurator, Action <IRetryConfigurator> configure) where TConsumer : class { if (configurator == null) { throw new ArgumentNullException(nameof(configurator)); } var observer = new MessageRetryConsumerConfigurationObserver <TConsumer>(configurator, CancellationToken.None, configure); configurator.ConnectConsumerConfigurationObserver(observer); }
/// <summary> /// Configures the message retry for the consumer consumer, regardless of message type. /// </summary> /// <param name="configurator"></param> /// <param name="busFactoryConfigurator"> /// 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 <TConsumer>(this IConsumerConfigurator <TConsumer> configurator, IBusFactoryConfigurator busFactoryConfigurator, Action <IRetryConfigurator> configure) where TConsumer : class { if (configurator == null) { throw new ArgumentNullException(nameof(configurator)); } var retryObserver = new RetryBusObserver(); busFactoryConfigurator.ConnectBusObserver(retryObserver); var observer = new MessageRetryConsumerConfigurationObserver <TConsumer>(configurator, retryObserver.Stopping, configure); configurator.ConnectConsumerConfigurationObserver(observer); }