Class ComputationPolicyBuilder

java.lang.Object
org.nuxeo.lib.stream.computation.ComputationPolicyBuilder

public class ComputationPolicyBuilder extends Object
Builder to create a ComputationPolicy.
Since:
10.3
  • Field Details

    • DEFAULT_BATCH_CAPACITY

      protected static final int DEFAULT_BATCH_CAPACITY
      See Also:
    • DEFAULT_BATCH_THRESHOLD_SECOND

      protected static final int DEFAULT_BATCH_THRESHOLD_SECOND
      See Also:
    • retryPolicy

      protected net.jodah.failsafe.RetryPolicy<Object> retryPolicy
    • skipFailure

      protected boolean skipFailure
    • skipFirstFailures

      protected int skipFirstFailures
    • batchCapacity

      protected int batchCapacity
    • batchThreshold

      protected Duration batchThreshold
  • Constructor Details

    • ComputationPolicyBuilder

      public ComputationPolicyBuilder()
  • Method Details

    • batchPolicy

      public ComputationPolicyBuilder batchPolicy(int capacity, Duration timeThreshold)
      Defines how to group records by batch using a capacity and a time threshold.

      This is used only by computation that extends AbstractBatchComputation.

      Parameters:
      capacity - the number of records in the batch
      timeThreshold - process the batch even if not full after this duration
    • retryPolicy

      public ComputationPolicyBuilder retryPolicy(net.jodah.failsafe.RetryPolicy<Object> policy)
      Defines what to do in case of failure during the batch processing.
    • continueOnFailure

      public ComputationPolicyBuilder continueOnFailure(boolean value)
      The fallback when processing a batch has failed after applying the retry policy has failed.
      Parameters:
      value - When true Skips the records affected by the batch in failure and continue.

      When false aborts the computation, this is the default behavior.

    • skipFirstFailures

      public ComputationPolicyBuilder skipFirstFailures(int failures)
      A recovery fallback that continues processing after failure only for a limited number of time.
      Since:
      11.1
    • build

      public ComputationPolicy build()
      Creates the policy.