Class ComputationPolicyBuilder


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

      • DEFAULT_BATCH_CAPACITY

        protected static final int DEFAULT_BATCH_CAPACITY
        See Also:
        Constant Field Values
      • DEFAULT_BATCH_THRESHOLD_SECOND

        protected static final int DEFAULT_BATCH_THRESHOLD_SECOND
        See Also:
        Constant Field Values
      • retryPolicy

        protected net.jodah.failsafe.RetryPolicy retryPolicy
      • skipFailure

        protected boolean skipFailure
      • skipFirstFailures

        protected int skipFirstFailures
      • batchCapacity

        protected int batchCapacity
      • batchThreshold

        protected Duration batchThreshold
    • Constructor Detail

      • ComputationPolicyBuilder

        public ComputationPolicyBuilder()
    • Method Detail

      • 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 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