Tumbling window analytics

Tumbling windows are useful to gain fixed analytic insights over a period of either time-based or a fixed count of events.


This example provides a demonstration of the available OOTB aggregate functions Joule provides that work with tumbling windows.

Use case configuration

File: app-tumblingWindowAnalytics.env

SOURCEFILE=conf/sources/stockQuoteStream.yaml
ENGINEFILE=conf/usecases/tumblingWindowAnalytics.yaml
PUBLISHFILE=conf/publishers/fileStandardAnalytics.yaml

Pipeline configuration

This pipeline will perform two functions. Firstly store every event in the in-memory database and then build 5-second tumbling windows resulting in the defined aggregate functions being executed over the event

processing unit:
  pipeline:
    - time window:
        emitting type: tumblingQuoteAnalytics
        aggregate functions:
          FIRST: [ask]
          LAST: [ ask ]
          MIN: [ ask ]
          MAX: [ bid ]
          SUM: [ volume ]
          MEAN: [ volatility ]
          HARMONIC_MEAN: [ volatility ]
          VARIANCE: [ volatility ]
          STDEV: [ volatility ]
        policy:
          type: tumblingTime
          window size: 5000

select:
  expression: "symbol, ask_FIRST, ask_LAST, ask_MIN, bid_MAX, volume_SUM, volatility_MEAN, volatility_HARMONIC_MEAN, volatility_VARIANCE, volatility_STDEV"

group by:
  - symbol

Last updated