stream-processing-expert
БесплатноБез исполняемых скриптовНе проверенBuild continuous data pipelines over event streams: windowing, watermarks, exactly-once semantics, stateful processing and change data capture. Use when the…
от personamanagmentlayer★ 46 звёзд на GitHubОб этом скилле
Stream Processing Expert
Continuous computation over unbounded data. The hard parts are not throughput —
they are time, state and what happens when something is retried. Complements
kafka-expert (the transport) and airflow-expert (batch orchestration).
Core Concepts
Event Time, Not Processing Time
Every event carries the time it happened. The stream processor sees it later, out of order, sometimes much later. Windowing on arrival time produces results that change if you replay the same data — which makes them untestable and unreproducible.
| Time | Meaning | Use |
|---|---|---|
| Event time | When it happened, from the payload | Correctness; all business aggregation |
| Ingestion time | When the broker received it | Rough operational metrics |
| Processing time | When the operator ran | Latency monitoring only |
If the source has no reliable event timestamp, that is a defect in the producer. Fix it there.
Watermarks
A watermark is the processor's assertion that no event older than time T will arrive. It is how an unbounded stream produces a finite answer: when the watermark passes the end of a window, the window closes and emits.
The watermark is a bet on lateness. Too tight and correct data is dropped; too loose and every result waits.
# Flink: allow 30 seconds of out-of-orderness
watermark_strategy = (
WatermarkStrategy
.for_bounded_out_of_orderness(Duration.of_seconds(30))
.with_timestamp_assigner(lambda event, _: event["occurred_at_ms"])
.with_idleness(Duration.of_minutes(1)) # an idle partition must not stall time
)
with_idleness matters in production: a partition with no traffic holds the
watermark back for the whole job, and every window stops emitting. This is a
frequent and confusing outage.
Windows
| Window | Shape | Use |
|---|---|---|
| Tumbling | Fixed, non-overlapping | Hourly totals, daily counts |
| Sliding | Fixed, overlapping | "Last 5 minutes, updated every minute" |
| Session | Gap-defined | User activity bursts |
| Global + trigger | Custom | Anything the above cannot express |
Sliding windows multiply state: a 1-hour window sliding every minute keeps each event in 60 windows. Check the cost before choosing the slide.
Delivery Semantics
- At most once — losses on failure. Rarely acceptable.
- At least once — duplicates on retry. Acceptable when the sink is idempotent.
- Exactly once — no loss, no duplicates, within the system's boundaries. Achieved by checkpointed state plus a transactional or idempotent sink. It is not magic: a sink that cannot participate in a transaction cannot give it to you.
The pragmatic default: at-least-once processing with an idempotent sink keyed on a business identifier. It is simpler, cheaper and survives more failure modes than end-to-end transactions.
Flink
from pyflink.table import EnvironmentSettings, TableEnvironment
t_env = TableEnvironment.create(EnvironmentSettings.in_streaming_mode())
t_env.execute_sql("""
CREATE TABLE orders (
order_id STRING,
customer_id STRING,
amount_minor BIGINT,
occurred_at TIMESTAMP_LTZ(3),
WATERMARK FOR occurred_at AS occurred_at - INTERVAL '30' SECOND
) WITH (
'connector' = 'kafka',
'topic' = 'orders',
'properties.bootstrap.servers' = 'kafka:9092',
'properties.group.id' = 'revenue-agg',
'scan.startup.mode' = 'group-offsets',
'format' = 'json',
'json.ignore-parse-errors' = 'true'
)""")
t_env.execute_sql("""
INSERT INTO revenue_by_hour
SELECT window_start, window_end, customer_id,
SUM(amount_minor) AS revenue_minor,
COUNT(*) AS order_count
FROM TABLE(TUMBLE(TABLE orders, DESCRIPTOR(occurred_at), INTERVAL '1' HOUR))
GROUP BY window_start, window_end, customer_id
""")
Checkpointing is what makes state recoverable:
env.enable_checkpointing(60_000) # every 60s
config = env.get_checkpoint_config()
config.set_checkpointing_mode(CheckpointingMode.EXACTLY_ONCE)
config.set_min_pause_between_checkpoints(30_000)
config.set_checkpoint_timeout(600_000)
config.enable_externalized_checkpoints(
ExternalizedCheckpointCleanup.RETAIN_ON_CANCELLATION)
Retaining checkpoints on cancellation is essential — without it, stopping a job discards the state you need to resume.
Spark Structured Streaming
Micro-batch rather than true streaming; simpler to operate if you already run Spark, at the cost of latency measured in seconds.
events = (spark.readStream
.format("kafka
Установить stream-processing-expert в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditBash(python:*, python3:*, pip:*, docker:*, kafka-topics:*, flink:*, spark-submit:*)GrepGlobВложенные файлы
FAQ
Что делает скилл stream-processing-expert?
Build continuous data pipelines over event streams: windowing, watermarks, exactly-once semantics, stateful processing and change data capture. Use when the user mentions stream processing, Flink, Spark Structured Streaming, CDC or Debezium, event time versus processing time, watermarks, tumbling or sliding windows, late-arriving data, or when the task involves replicating a database into a stream or computing continuous aggregates.
Как установить скилл stream-processing-expert?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл stream-processing-expert запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic