public class ComputationPolicyBuilder extends Object
Modifier and Type | Field and 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 |
Constructor and Description |
---|
ComputationPolicyBuilder() |
Modifier and Type | Method and 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.
|
protected static final int DEFAULT_BATCH_CAPACITY
protected static final int DEFAULT_BATCH_THRESHOLD_SECOND
protected net.jodah.failsafe.RetryPolicy retryPolicy
protected boolean skipFailure
protected int batchCapacity
protected Duration batchThreshold
public ComputationPolicyBuilder()
public ComputationPolicyBuilder batchPolicy(int capacity, Duration timeThreshold)
This is used only by computation that extends AbstractBatchComputation.
capacity
- the number of records in the batchtimeThreshold
- process the batch even if not full after this durationpublic ComputationPolicyBuilder retryPolicy(net.jodah.failsafe.RetryPolicy policy)
public ComputationPolicyBuilder continueOnFailure(boolean value)
value
- When true
Skips the records affected by the batch in failure and continue.false
aborts the computation, this is the default behavior.public ComputationPolicy build()
Copyright © 2019 Nuxeo. All rights reserved.