Package org.nuxeo.lib.stream.computation
Interface ComputationContext
-
- All Known Implementing Classes:
ComputationContextImpl
public interface ComputationContext- Since:
- 9.3
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaskForCheckpoint()Ask for checkpoint in order to send records, save input stream offset positions.voidaskForTermination()Ask to terminate this computation.voidcancelAskForCheckpoint()Finally cancel the request to checkpoint the positions.LogOffsetgetLastOffset()ComputationPolicygetPolicy()Gets the policy used to run the computation.booleanisSpareComputation()default voidproduceRecord(String streamName, String key, byte[] data)Emit a record downstream.voidproduceRecord(String streamName, Record record)voidsetSourceLowWatermark(long watermark)Set the low watermark for a source computation.voidsetTimer(String key, long time)Register a timer callback for some point in the future
-
-
-
Method Detail
-
setTimer
void setTimer(String key, long time)
Register a timer callback for some point in the future- Parameters:
key- Name of the timer callback.time- The (ms since epoch) at which the callback should be fired
-
produceRecord
default void produceRecord(String streamName, String key, byte[] data)
Emit a record downstream. Records are send effectively on checkpoint usingaskForCheckpoint().- Parameters:
streamName- The name of the stream on which the record should be emitted.key- The key associated with the record. Only relevant when routing method is `GROUP_BY`.data- The binary blob to send downstream.
-
setSourceLowWatermark
void setSourceLowWatermark(long watermark)
Set the low watermark for a source computation.
-
askForCheckpoint
void askForCheckpoint()
Ask for checkpoint in order to send records, save input stream offset positions.
-
cancelAskForCheckpoint
void cancelAskForCheckpoint()
Finally cancel the request to checkpoint the positions.
-
askForTermination
void askForTermination()
Ask to terminate this computation.- Since:
- 10.1
-
getLastOffset
LogOffset getLastOffset()
- Returns:
- the LogOffset of the last record read.
- Since:
- 10.3
-
getPolicy
ComputationPolicy getPolicy()
Gets the policy used to run the computation.- Since:
- 10.3
-
isSpareComputation
boolean isSpareComputation()
- Returns:
trueif the computation is a spare instance without any Stream partition assigned. A spare computation will not receive any record and its timer will not be executed.- Since:
- 11.1
-
-