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,StreamIntrospectionComputation,StreamMetricsComputation,WorkComputation,WorkManagerRunWorkInFailure.WorkFailureComputation
public abstract class AbstractComputation extends Object implements Computation
An abstractComputationthat 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
-
-
Constructor Summary
Constructors Constructor Description AbstractComputation(String name, int nbInputStreams, int nbOutputStreams)Creates a computation with the requested number of input and output streams.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinit(ComputationContext context)Called when the framework has registered the computation successfully.ComputationMetadatametadata()Identify the computation.voidprocessFailure(ComputationContext context, Throwable failure)voidprocessRetry(ComputationContext context, Throwable failure)voidprocessTimer(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 Detail
-
metadata
protected final ComputationMetadata metadata
-
INPUT_1
public static final String INPUT_1
- See Also:
- Constant Field Values
-
INPUT_2
public static final String INPUT_2
- See Also:
- Constant Field Values
-
INPUT_3
public static final String INPUT_3
- See Also:
- Constant Field Values
-
OUTPUT_1
public static final String OUTPUT_1
- See Also:
- Constant Field Values
-
OUTPUT_2
public static final String OUTPUT_2
- See Also:
- Constant Field Values
-
OUTPUT_3
public static final String OUTPUT_3
- See Also:
- Constant Field Values
-
OUTPUT_4
public static final String OUTPUT_4
- See Also:
- Constant Field Values
-
INPUT_NULL
public static final String INPUT_NULL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractComputation
public AbstractComputation(String name, int nbInputStreams, int nbOutputStreams)
Creates a computation with the requested number of input and output streams.- Since:
- 10.3
-
-
Method Detail
-
init
public void init(ComputationContext context)
Description copied from interface:ComputationCalled 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:
initin interfaceComputation- Parameters:
context- The computation context object provided by the system.
-
processTimer
public void processTimer(ComputationContext context, String key, long timestamp)
Description copied from interface:ComputationProcess a timer callback previously set viaComputationContext.setTimer(String, long).- Specified by:
processTimerin 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
public ComputationMetadata metadata()
Description copied from interface:ComputationIdentify the computation.- Specified by:
metadatain interfaceComputation- Returns:
- computation's metadata.
-
processRetry
public void processRetry(ComputationContext context, Throwable failure)
Description copied from interface:ComputationCalled 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:
processRetryin interfaceComputation
-
processFailure
public void processFailure(ComputationContext context, Throwable failure)
Description copied from interface:ComputationCalled 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:
processFailurein interfaceComputation
-
-