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 void
askForCheckpoint()
Ask for checkpoint in order to send records, save input stream offset positions.void
askForTermination()
Ask to terminate this computation.void
cancelAskForCheckpoint()
Finally cancel the request to checkpoint the positions.LogOffset
getLastOffset()
ComputationPolicy
getPolicy()
Gets the policy used to run the computation.boolean
isSpareComputation()
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
setTimer(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:
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
-
-