stream-processor (v1.0.0)

Aggregates MES events into running shift metrics

Overview

The stream-processor service is a pure Kafka Streams application (no Spring Boot) that joins factory floor MES events with production line configuration, maintains running shift aggregates per line, and emits snapshots downstream whenever meaningful changes occur.

Key Behaviors

  • KStream-KTable join: MES events are enriched with line configuration (factory, operation area, process line) via a left join on lineId
  • Event-driven shift windows: Shift boundaries are determined by SHIFT_STARTED and SHIFT_ENDED events, not time-based tumbling windows
  • Change detection filter: Only emits a ShiftAggregate when scrap count changes or scrap rate changes by ≥0.5%, preventing downstream flooding
  • Exactly-once semantics: Configured with processing.guarantee=exactly_once_v2

State Store

StoreTypeKeyValue
shift-aggregates-storeKeyValueStorelineId (String)ShiftAggregate

Data Simulator

The DataSimulator CLI tool is included in this module for local development. It generates realistic MES events across 3 production lines, including a scrap spike scenario on LINE-1.

Terminal window
mvn exec:java -pl stream-processor \
-Dexec.mainClass=com.kstreamalarm.processor.simulator.DataSimulator