/// <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 <TSaga>(this ISagaConfigurator <TSaga> configurator, Action <IRetryConfigurator> configure) where TSaga : class, ISaga { if (configurator == null) { throw new ArgumentNullException(nameof(configurator)); } var observer = new MessageRetrySagaConfigurationObserver <TSaga>(configurator, CancellationToken.None, configure); configurator.ConnectSagaConfigurationObserver(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 <TSaga>(this ISagaConfigurator <TSaga> configurator, IBusFactoryConfigurator busFactoryConfigurator, Action <IRetryConfigurator> configure) where TSaga : class, ISaga { if (configurator == null) { throw new ArgumentNullException(nameof(configurator)); } var retryObserver = new RetryBusObserver(); busFactoryConfigurator.ConnectBusObserver(retryObserver); var observer = new MessageRetrySagaConfigurationObserver <TSaga>(configurator, retryObserver.Stopping, configure); configurator.ConnectSagaConfigurationObserver(observer); }