Package org.nuxeo.lib.stream.computation
Interface ComputationContext
- All Known Implementing Classes:
ComputationContextImpl
public interface ComputationContext
- Since:
- 9.3
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Ask for checkpoint in order to send records, save input stream offset positions.void
Ask to terminate this computation.void
Finally cancel the request to checkpoint the positions.Gets the policy used to run the computation.boolean
default void
produceRecord
(String streamName, String key, byte[] data) Emit a record downstream.void
produceRecord
(String streamName, Record record) void
setSourceLowWatermark
(long watermark) Set the low watermark for a source computation.void
Register a timer callback for some point in the future
-
Method Details
-
setTimer
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
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.
-
produceRecord
-
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:
true
if 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
-