Class ConsumerRetryBlock<P,E extends Throwable>

java.lang.Object
com.sdl.delivery.retry.AbstractRetryBlock<P,E>
com.sdl.delivery.retry.ConsumerRetryBlock<P,E>
Type Parameters:
P - parameter type
E - exception type

public class ConsumerRetryBlock<P,E extends Throwable> extends AbstractRetryBlock<P,E>
Used to perform retries. Based on Consumer.
  • Constructor Details

    • ConsumerRetryBlock

      public ConsumerRetryBlock(ThrowableConsumer<P,E> consumer, Supplier<P> propertyProvider)
      Creates RetryBlock object. Note: The real execution is done within execute(). So the propertyProvider is not called, unless execute() is called. The property will be re-evaluated for each attempt.
      Parameters:
      consumer - consumer, which should be executed.
      propertyProvider - Supplier for request property.
    • ConsumerRetryBlock

      public ConsumerRetryBlock(ThrowableConsumer<P,E> consumer, Supplier<P> propertyProvider, int maxRetryCount, int attemptDelayFactor)
      Creates RetryBlock object. Note: The real execution is done within execute(). So the propertyProvider is not called, unless execute() is called. The property will be re-evaluated for each attempt.
      Parameters:
      consumer - consumer, which should be executed.
      propertyProvider - Supplier for request property.
      maxRetryCount - max retry count
      attemptDelayFactor - attempt delay factor, used to scale thread sleep time between retries
  • Method Details

    • execute

      public void execute() throws E
      Throws:
      E extends Throwable