public interface Computation
Modifier and Type | Method and Description |
---|---|
default void |
destroy()
Called when the framework is ready to shutdown the computation.
|
void |
init(ComputationContext context)
Called when the framework has registered the computation successfully.
|
ComputationMetadata |
metadata()
Identify the computation.
|
void |
processFailure(ComputationContext context,
Throwable failure)
|
void |
processRecord(ComputationContext context,
String inputStreamName,
Record record)
Process an incoming record on one of the computation's input streams.
|
void |
processRetry(ComputationContext context,
Throwable failure)
|
void |
processTimer(ComputationContext context,
String key,
long timestamp)
Process a timer callback previously set via
ComputationContext.setTimer(String, long) . |
default void |
signalStop()
A hook to inform that computation will be soon destroyed.
|
void init(ComputationContext context)
context
- The computation context object provided by the system.default void destroy()
void processRecord(ComputationContext context, String inputStreamName, Record record)
context
- The computation context object provided by the system.inputStreamName
- Name of the input stream that provides the record.record
- The record.void processTimer(ComputationContext context, String key, long timestamp)
ComputationContext.setTimer(String, long)
.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.ComputationMetadata metadata()
default void signalStop()
void processRetry(ComputationContext context, Throwable failure)
processRecord(org.nuxeo.lib.stream.computation.ComputationContext, java.lang.String, org.nuxeo.lib.stream.computation.Record)
or processTimer(org.nuxeo.lib.stream.computation.ComputationContext, java.lang.String, long)
before retrying.void processFailure(ComputationContext context, Throwable failure)
processRecord(org.nuxeo.lib.stream.computation.ComputationContext, java.lang.String, org.nuxeo.lib.stream.computation.Record)
or processTimer(org.nuxeo.lib.stream.computation.ComputationContext, java.lang.String, long)
fails and cannot be retried.Copyright © 2019 Nuxeo. All rights reserved.