Skip to content
Aryan Deshmukh

Library · Go

event-order

Put out-of-order events back in event-time order: generic Go library, watermark and bounded delay, no dependencies

Source on GitHubruns locallyCI passing

Why it exists

Ordering by event time is a solved idea in stream processors, but a Go service that reads a Kafka topic or an MQTT feed has no small piece to do it with, and no piece at all for the commit-offset and duplicate problems that appear the moment events are held. Building it taught that the ordering is the smallest part: the work is in the boundary cases and in proving them against a model.

What it does

  1. 01

    Event-time ordering with a bounded delay. Buffer releases events once the watermark passes them, sorted.

  2. 02

    Per-key buffers (Keyed) that forget idle keys, and goroutine-safe wrappers (Safe, SafeKeyed, Pipe).

  3. 03

    Safe commit offsets (Tracker, KeyedTracker) with Revoke for rebalances.

  4. 04

    Bounded duplicate window (Dedup).

  5. 05

    Sequence-number ordering (Sequencer). exact order without a delay, a bounded wait for gaps, OnGap and OnStale for what never fills.

  6. 06

    Aligned watermark (Aligned) over several sources, with idle handling and a lag report.

Next

Fintech Fraud Detection