Class

com.twitter.finatra.streams.transformer

AggregatorTransformer

Related Doc: package transformer

Permalink

class AggregatorTransformer[K, V, Aggregate] extends FinatraTransformerV2[K, V, TimeWindowed[K], WindowedValue[Aggregate]] with CachingKeyValueStores[K, V, TimeWindowed[K], WindowedValue[Aggregate]] with PersistentTimers

An aggregating transformer for fixed windows which offers additional controls that are not included in the built in Kafka Streams Windowing DSL

A TimeWindow is a tumbling window of fixed length defined by the windowSize parameter.

A Window is closed after event time passes the end of a TimeWindow + allowedLateness.

After a window is closed, if emitOnClose=true it is forwarded out of this transformer with a WindowedValue.resultState of com.twitter.finatra.streams.transformer.domain.WindowClosed

If a record arrives after a window is closed it is immediately forwarded out of this transformer with a WindowedValue.resultState of com.twitter.finatra.streams.transformer.domain.Restatement

returns

a stream of Keys for a particular timewindow, and the aggregations of the values for that key within a particular timewindow.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AggregatorTransformer
  2. PersistentTimers
  3. CachingKeyValueStores
  4. FlushingTransformer
  5. Flushing
  6. FinatraTransformerV2
  7. ProcessorContextLogging
  8. OnClose
  9. OnWatermark
  10. OnInit
  11. Transformer
  12. AnyRef
  13. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new AggregatorTransformer(statsReceiver: StatsReceiver, stateStoreName: String, timerStoreName: String, windowSize: Duration, allowedLateness: Duration, initializer: () ⇒ Aggregate, aggregator: ((K, V), Aggregate) ⇒ Aggregate, customWindowStart: (Time, K, V) ⇒ Long, emitOnClose: Boolean = false, queryableAfterClose: Duration, emitUpdatedEntriesOnCommit: Boolean, commitInterval: Duration)

    Permalink

    statsReceiver

    The StatsReceiver for collecting stats

    stateStoreName

    the name of the StateStore used to maintain the counts.

    timerStoreName

    the name of the StateStore used to maintain the timers.

    windowSize

    splits the stream of data into buckets of data of windowSize, based on the timestamp of each message.

    allowedLateness

    allow messages that are upto this amount late to be added to the store, otherwise they are emitted as restatements.

    initializer

    Initializer function that computes an initial intermediate aggregation result

    aggregator

    Aggregator function that computes a new aggregate result

    emitOnClose

    Emit messages for each entry in the window when the window close. Emitted entries will have a WindowResultType set to WindowClosed.

    queryableAfterClose

    allow state to be queried upto this amount after the window is closed.

    emitUpdatedEntriesOnCommit

    Emit messages for each updated entry in the window on the Kafka Streams commit interval. Emitted entries will have a WindowResultType set to WindowOpen.

Type Members

  1. implicit class RichLong extends AnyRef

    Permalink
    Definition Classes
    ProcessorContextLogging

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def close(): Unit

    Permalink
    Definition Classes
    FinatraTransformerV2 → Transformer
  7. val commitInterval: Duration

    Permalink
    Definition Classes
    AggregatorTransformerFlushing
  8. final def debug(message: ⇒ Any): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    ProcessorContextLogging
  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def error(message: ⇒ Any): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    ProcessorContextLogging
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. val finatraKeyValueStoresMap: Map[String, FinatraKeyValueStore[_, _]]

    Permalink
    Attributes
    protected[com.twitter.finatra.streams]
    Definition Classes
    FinatraTransformerV2
  14. final def forward(key: TimeWindowed[K], value: WindowedValue[Aggregate], timestamp: Long): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    FinatraTransformerV2
  15. final def forward(key: TimeWindowed[K], value: WindowedValue[Aggregate]): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    FinatraTransformerV2
  16. def getCachingKeyValueStore[KK, VV](name: String)(implicit arg0: ClassTag[KK]): CachingFinatraKeyValueStore[KK, VV]

    Permalink

    Lookup a caching key value store by name

    Lookup a caching key value store by name

    KK

    Type of keys in the store

    VV

    Type of values in the store

    name

    The name of the store

    returns

    A caching key value store

    Attributes
    protected
    Definition Classes
    CachingKeyValueStores
  17. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  18. final def getKeyValueStore[KK, VV](name: String)(implicit arg0: ClassTag[KK]): FinatraKeyValueStore[KK, VV]

    Permalink
    Attributes
    protected
    Definition Classes
    FinatraTransformerV2
  19. def getPersistentTimerStore[TimerKey](timerStoreName: String, onTimer: (Time, TimerMetadata, TimerKey) ⇒ Unit, punctuationType: PunctuationType, maxTimerFiresPerWatermark: Int = 10000): PersistentTimerStore[TimerKey]

    Permalink
    Attributes
    protected
    Definition Classes
    PersistentTimers
  20. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  21. final def info(message: ⇒ Any): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    ProcessorContextLogging
  22. final def init(processorContext: ProcessorContext): Unit

    Permalink
    Definition Classes
    FinatraTransformerV2 → Transformer
  23. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  24. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  25. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  26. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  27. def onClose(): Unit

    Permalink
    Definition Classes
    FlushingOnClose
  28. def onFlush(): Unit

    Permalink
    Definition Classes
    CachingKeyValueStoresFlushing
  29. def onInit(): Unit

    Permalink
    Definition Classes
    AggregatorTransformerPersistentTimersFlushingOnInit
  30. def onMessage(time: Time, key: K, value: V): Unit

    Permalink

    Callback method which is called for every message in the stream this Transformer is attached to.

    Callback method which is called for every message in the stream this Transformer is attached to. Implementers of this method may emit 0 or more records by using the processorContext.

    key

    the key of the message

    value

    the value of the message

    Definition Classes
    AggregatorTransformerFinatraTransformerV2
  31. final def onWatermark(watermark: Watermark): Unit

    Permalink
    Definition Classes
    PersistentTimersOnWatermark
  32. def processorContext: ProcessorContext

    Permalink
    Attributes
    protected
    Definition Classes
    FinatraTransformerV2ProcessorContextLogging
  33. val statsReceiver: StatsReceiver

    Permalink

    The StatsReceiver for collecting stats

    The StatsReceiver for collecting stats

    Definition Classes
    AggregatorTransformerCachingKeyValueStores
  34. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  35. final def taskIdStr: String

    Permalink
    Attributes
    protected
    Definition Classes
    ProcessorContextLogging
  36. final def timeStr: String

    Permalink
    Attributes
    protected
    Definition Classes
    ProcessorContextLogging
  37. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  38. final def trace(message: ⇒ Any): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    ProcessorContextLogging
  39. final def transform(k: K, v: V): (TimeWindowed[K], WindowedValue[Aggregate])

    Permalink
    Definition Classes
    FinatraTransformerV2 → Transformer
  40. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. final def warn(message: ⇒ Any): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    ProcessorContextLogging
  44. final def watermark: Watermark

    Permalink
    Attributes
    protected
    Definition Classes
    FinatraTransformerV2

Deprecated Value Members

  1. def logger: Logger

    Permalink
    Attributes
    protected
    Definition Classes
    ProcessorContextLogging
    Annotations
    @deprecated
    Deprecated

    Use error, warn, info, debug, or trace methods directly

Inherited from PersistentTimers

Inherited from CachingKeyValueStores[K, V, TimeWindowed[K], WindowedValue[Aggregate]]

Inherited from FlushingTransformer[K, V, TimeWindowed[K], WindowedValue[Aggregate]]

Inherited from Flushing

Inherited from FinatraTransformerV2[K, V, TimeWindowed[K], WindowedValue[Aggregate]]

Inherited from ProcessorContextLogging

Inherited from OnClose

Inherited from OnWatermark

Inherited from OnInit

Inherited from Transformer[K, V, (TimeWindowed[K], WindowedValue[Aggregate])]

Inherited from AnyRef

Inherited from Any

Ungrouped