Package org.voltdb.stream.api.pipeline
Interface VoltFunction<I,O>
- Type Parameters:
I
- input event typeO
- output event type
- All Superinterfaces:
VoltLifecycle
- All Known Implementing Classes:
BatchAccumulator
,CancelingFunction
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
This class represents a simple transformation between input event and output message.
The function can emit any number of messages to a downstream component represented by a consumer.
Function's lifecycle is - initialize - configure - nextBatchStarts* - process* - batchProcessed* - destroy
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
batchProcessed
(long batchId) the callback is invoked when the function finishes processing a batch of datadefault void
initialize
(Consumer<O> consumer) the callback is invoked when the function is created and a consumer is assigned but the function is not yet scheduled to handle any incoming events.default void
nextBatchStarts
(long batchId) the callback is invoked when the function starts processing a new batch of datavoid
process
(I input, Consumer<O> consumer, ExecutionContext context) processes input and emits output messages to a consumerMethods inherited from interface org.voltdb.stream.api.pipeline.VoltLifecycle
configure, destroy
-
Method Details
-
initialize
the callback is invoked when the function is created and a consumer is assigned but the function is not yet scheduled to handle any incoming events.- Parameters:
consumer
- a downstream consumer used to emit transformed events to it
-
nextBatchStarts
default void nextBatchStarts(long batchId) the callback is invoked when the function starts processing a new batch of data- Parameters:
batchId
- globally unique id to track messages related to current batch of data
-
process
processes input and emits output messages to a consumer- Parameters:
input
- messageconsumer
- binds this function with next stepcontext
- of the execution
-
batchProcessed
default void batchProcessed(long batchId) the callback is invoked when the function finishes processing a batch of data- Parameters:
batchId
- globally unique id to track messages related to current batch of data
-