Interface VoltFunction<I,O>

Type Parameters:
I - input event type
O - 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.

@FunctionalInterface public interface VoltFunction<I,O> extends VoltLifecycle
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 Type
    Method
    Description
    default void
    batchProcessed(long batchId)
    the callback is invoked when the function finishes processing a batch of data
    default 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 data
    void
    process(I input, Consumer<O> consumer, ExecutionContext context)
    processes input and emits output messages to a consumer

    Methods inherited from interface org.voltdb.stream.api.pipeline.VoltLifecycle

    configure, destroy
  • Method Details

    • initialize

      default 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.
      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

      void process(I input, Consumer<O> consumer, ExecutionContext context)
      processes input and emits output messages to a consumer
      Parameters:
      input - message
      consumer - binds this function with next step
      context - 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