Add a timestamp to each element using WithTimestamps so Beam knows its event time.
Call .apply(Window.into(...)) on the PCollection and pass the desired window strategy: FixedWindows.of(Duration.standardMinutes(5)), SlidingWindows.of(...).every(...), or Sessions.withGapDuration(...).
Chain a GroupByKey or Combine operation after the window; results are scoped to each window pane.
Configure triggers and accumulation mode on the WindowingStrategy if you need early or late firings beyond the default end-of-window trigger.
Run on a streaming runner (Dataflow, Flink) to see real event-time windowing; DirectRunner supports windowing for local testing.
Known gotchas
Without WithTimestamps the pipeline falls back to processing time, making event-time windows meaningless.
SlidingWindows can assign each element to multiple windows (period < size), multiplying downstream load.
Session windows are per-key, so a single PCollection can have windows of different durations across keys.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp