Package org.nuxeo.lib.stream.computation
Class AbstractComputation
java.lang.Object
org.nuxeo.lib.stream.computation.AbstractComputation
- All Implemented Interfaces:
Computation
- Direct Known Subclasses:
AbstractBatchComputation
,AbstractBulkComputation
,AbstractTransientBlobComputation
,BulkIndexComputation
,BulkScrollerComputation
,BulkStatusComputation
,IndexCompletionComputation
,LatencyTrackerComputation
,StreamAuditStorageWriter.AuditStorageLogWriterComputation
,StreamDocumentGC.DocumentGCComputation
,StreamIntrospectionComputation
,StreamMetricsComputation
,StreamOrphanBlobGC.BlobGCComputation
,WorkComputation
,WorkManagerRunWorkInFailure.WorkFailureComputation
An abstract
Computation
that manages the metadata init.
By convention the inputs streams are named internally: i1, i2 ...
and the output streams are named: o1, o2 ...
- Since:
- 9.3
-
Field Summary
-
Constructor Summary
ConstructorDescriptionAbstractComputation
(String name, int nbInputStreams, int nbOutputStreams) Creates a computation with the requested number of input and output streams. -
Method Summary
Modifier and TypeMethodDescriptionvoid
init
(ComputationContext context) Called when the framework has registered the computation successfully.metadata()
Identify the computation.void
processFailure
(ComputationContext context, Throwable failure) void
processRetry
(ComputationContext context, Throwable failure) void
processTimer
(ComputationContext context, String key, long timestamp) Process a timer callback previously set viaComputationContext.setTimer(String, long)
.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, processRecord, signalStop
-
Field Details
-
metadata
-
INPUT_1
- See Also:
-
INPUT_2
- See Also:
-
INPUT_3
- See Also:
-
OUTPUT_1
- See Also:
-
OUTPUT_2
- See Also:
-
OUTPUT_3
- See Also:
-
OUTPUT_4
- See Also:
-
INPUT_NULL
- See Also:
-
-
Constructor Details
-
AbstractComputation
Creates a computation with the requested number of input and output streams.- Since:
- 10.3
-
-
Method Details
-
init
Description copied from interface:Computation
Called when the framework has registered the computation successfully. Gives users a first opportunity to schedule timer callbacks and produce records. This method can be called multiple times.- Specified by:
init
in interfaceComputation
- Parameters:
context
- The computation context object provided by the system.
-
processTimer
Description copied from interface:Computation
Process a timer callback previously set viaComputationContext.setTimer(String, long)
.- Specified by:
processTimer
in interfaceComputation
- Parameters:
context
- The computation context object provided by the system.key
- The name of the timer.timestamp
- The timestamp (in ms) for which the callback was scheduled.
-
metadata
Description copied from interface:Computation
Identify the computation.- Specified by:
metadata
in interfaceComputation
- Returns:
- computation's metadata.
-
processRetry
Description copied from interface:Computation
Called after a failure inComputation.processRecord(org.nuxeo.lib.stream.computation.ComputationContext, java.lang.String, org.nuxeo.lib.stream.computation.Record)
orComputation.processTimer(org.nuxeo.lib.stream.computation.ComputationContext, java.lang.String, long)
before retrying.- Specified by:
processRetry
in interfaceComputation
-
processFailure
Description copied from interface:Computation
Called whenComputation.processRecord(org.nuxeo.lib.stream.computation.ComputationContext, java.lang.String, org.nuxeo.lib.stream.computation.Record)
orComputation.processTimer(org.nuxeo.lib.stream.computation.ComputationContext, java.lang.String, long)
fails and cannot be retried.- Specified by:
processFailure
in interfaceComputation
-