Class BulkScrollerComputation
- java.lang.Object
-
- org.nuxeo.lib.stream.computation.AbstractComputation
-
- org.nuxeo.ecm.core.bulk.computation.BulkScrollerComputation
-
- All Implemented Interfaces:
Computation
public class BulkScrollerComputation extends AbstractComputation
Materializes the document set for a command if scroller is not external.Inputs:
- i1: Reads a stream of
BulkCommand
sharded by action
Outputs:
- - "actionName": Writes
BulkBucket
into the action stream - - "status": Writes
BulkStatus
into the action stream
- Since:
- 10.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BulkScrollerComputation.Builder
-
Field Summary
Fields Modifier and Type Field Description protected String
actionStream
static long
BIG_BULK_COMMAND_THRESHOLD
protected int
bucketSize
protected List<String>
documentIds
static int
MAX_SCROLL_SIZE
protected boolean
produceImmediate
protected long
produceImmediateThreshold
protected int
scrollBatchSize
protected int
scrollKeepAliveSeconds
protected int
scrollSize
protected boolean
sequentialProcessing
protected int
transactionTimeoutSeconds
-
Fields inherited from class org.nuxeo.lib.stream.computation.AbstractComputation
INPUT_1, INPUT_2, INPUT_3, INPUT_NULL, metadata, OUTPUT_1, OUTPUT_2, OUTPUT_3, OUTPUT_4
-
-
Constructor Summary
Constructors Modifier Constructor Description BulkScrollerComputation(String name, int nbOutputStreams, int scrollBatchSize, int scrollKeepAliveSeconds, boolean produceImmediate)
BulkScrollerComputation(String name, int nbOutputStreams, int scrollBatchSize, int scrollKeepAliveSeconds, Duration transactionTimeout, boolean produceImmediate)
protected
BulkScrollerComputation(BulkScrollerComputation.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BulkScrollerComputation.Builder
builder(String name, int nbOutputStreams)
protected Scroll
buildScroll(BulkCommand command)
protected boolean
detectRetryOnFlushedScroll(String commandId)
protected void
flushRecords(ComputationContextImpl contextImpl, String commandId)
protected void
getCommandConfiguration(BulkCommand command)
protected boolean
isAbortedCommand(String commandId)
void
processRecord(ComputationContext context, String inputStreamName, Record record)
Process an incoming record on one of the computation's input streams.protected void
processRecord(ComputationContext context, Record record)
protected void
produceBucket(ComputationContext context, String commandId, int bucketSize, long bucketNumber, long documentCount)
Produces a bucket as a record to appropriate bulk action stream.protected void
updateStatusAfterScroll(ComputationContext context, String commandId, long documentCount, boolean limited)
protected void
updateStatusAfterScroll(ComputationContext context, String commandId, long documentCount, String errorMessage, Integer errorCode, boolean limited)
protected void
updateStatusAfterScroll(ComputationContext context, String commandId, String errorMessage, Integer errorCode)
protected void
updateStatusAsFlushing(ComputationContext context, String commandId)
protected void
updateStatusAsScrolling(ComputationContext context, String commandId)
-
Methods inherited from class org.nuxeo.lib.stream.computation.AbstractComputation
init, metadata, processFailure, processRetry, processTimer
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.lib.stream.computation.Computation
destroy, signalStop
-
-
-
-
Field Detail
-
MAX_SCROLL_SIZE
public static final int MAX_SCROLL_SIZE
- See Also:
- Constant Field Values
-
BIG_BULK_COMMAND_THRESHOLD
public static final long BIG_BULK_COMMAND_THRESHOLD
- See Also:
- Constant Field Values
-
scrollBatchSize
protected final int scrollBatchSize
-
scrollKeepAliveSeconds
protected final int scrollKeepAliveSeconds
-
produceImmediate
protected final boolean produceImmediate
-
produceImmediateThreshold
protected final long produceImmediateThreshold
-
transactionTimeoutSeconds
protected final int transactionTimeoutSeconds
-
scrollSize
protected int scrollSize
-
bucketSize
protected int bucketSize
-
actionStream
protected String actionStream
-
sequentialProcessing
protected boolean sequentialProcessing
-
-
Constructor Detail
-
BulkScrollerComputation
protected BulkScrollerComputation(BulkScrollerComputation.Builder builder)
-
BulkScrollerComputation
public BulkScrollerComputation(String name, int nbOutputStreams, int scrollBatchSize, int scrollKeepAliveSeconds, boolean produceImmediate)
- Parameters:
name
- the computation namenbOutputStreams
- the number of registered bulk action streamsscrollBatchSize
- the batch size to scrollscrollKeepAliveSeconds
- the scroll lifetimeproduceImmediate
- whether or not the record should be produced immedialitely while scrolling
-
-
Method Detail
-
builder
public static BulkScrollerComputation.Builder builder(String name, int nbOutputStreams)
-
processRecord
public void processRecord(ComputationContext context, String inputStreamName, Record record)
Description copied from interface:Computation
Process an incoming record on one of the computation's input streams.- Parameters:
context
- The computation context object provided by the system.inputStreamName
- Name of the input stream that provides the record.record
- The record.
-
processRecord
protected void processRecord(ComputationContext context, Record record)
-
detectRetryOnFlushedScroll
protected boolean detectRetryOnFlushedScroll(String commandId)
-
buildScroll
protected Scroll buildScroll(BulkCommand command)
-
getCommandConfiguration
protected void getCommandConfiguration(BulkCommand command)
-
isAbortedCommand
protected boolean isAbortedCommand(String commandId)
-
updateStatusAsFlushing
protected void updateStatusAsFlushing(ComputationContext context, String commandId)
-
updateStatusAsScrolling
protected void updateStatusAsScrolling(ComputationContext context, String commandId)
-
updateStatusAfterScroll
protected void updateStatusAfterScroll(ComputationContext context, String commandId, String errorMessage, Integer errorCode)
-
updateStatusAfterScroll
protected void updateStatusAfterScroll(ComputationContext context, String commandId, long documentCount, boolean limited)
-
updateStatusAfterScroll
protected void updateStatusAfterScroll(ComputationContext context, String commandId, long documentCount, String errorMessage, Integer errorCode, boolean limited)
-
produceBucket
protected void produceBucket(ComputationContext context, String commandId, int bucketSize, long bucketNumber, long documentCount)
Produces a bucket as a record to appropriate bulk action stream.
-
flushRecords
protected void flushRecords(ComputationContextImpl contextImpl, String commandId)
-
-