Package org.nuxeo.lib.stream.computation
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 Summary
Fields Modifier and Type Field Description protected int
batchCapacity
protected Duration
batchThreshold
protected static int
DEFAULT_BATCH_CAPACITY
protected static int
DEFAULT_BATCH_THRESHOLD_SECOND
protected net.jodah.failsafe.RetryPolicy
retryPolicy
protected boolean
skipFailure
protected int
skipFirstFailures
-
Constructor Summary
Constructors Constructor Description ComputationPolicyBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ComputationPolicyBuilder
batchPolicy(int capacity, Duration timeThreshold)
Defines how to group records by batch using a capacity and a time threshold.ComputationPolicy
build()
Creates the policy.ComputationPolicyBuilder
continueOnFailure(boolean value)
The fallback when processing a batch has failed after applying the retry policy has failed.ComputationPolicyBuilder
retryPolicy(net.jodah.failsafe.RetryPolicy policy)
Defines what to do in case of failure during the batch processing.ComputationPolicyBuilder
skipFirstFailures(int failures)
A recovery fallback that continues processing after failure only for a limited number of time.
-
-
-
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
-
-
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 batchtimeThreshold
- 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
- Whentrue
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.
-
-