Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:1kbgz Tributary Reactive Streaming

From Leeroopedia
Knowledge Sources
Domains Streaming, Reactive_Programming
Last Updated 2026-10-14 00:00 GMT

Overview

A reactive data flow paradigm where data propagates forward through a directed acyclic graph of nodes, each producing values asynchronously via generators and consuming upstream values via input queues.

Description

Reactive streaming models computation as a forward-propagating graph where each node is an async entity that consumes values from upstream input queues, applies a transformation, and pushes results downstream. Unlike pull-based (lazy) evaluation, streaming nodes are data-driven: they fire when inputs arrive rather than when their values are requested.

This paradigm addresses the limitation of batch processing for real-time data: instead of collecting all data before processing, each value flows through the graph as it arrives. The async generator protocol (PEP 525) enables Python-native cooperative multitasking, allowing multiple nodes to execute concurrently within a single asyncio event loop.

Key characteristics:

  • Forward propagation: Data flows from sources through transforms to sinks.
  • Async execution: Nodes run as coroutines, scheduled by the event loop.
  • Backpressure: Downstream congestion can be signaled upstream.
  • Tick policies: Mismatched production/consumption rates are handled via drop, replace, or repeat semantics.

Usage

Use this principle when designing systems for real-time data processing, event-driven pipelines, or any scenario where data arrives incrementally and must be processed immediately. It is the foundation for ETL pipelines, streaming analytics, and financial market data processing.

Theoretical Basis

The reactive streaming model is based on the dataflow programming paradigm. Each node is a process that:

  1. Reads from input queues (one per upstream dependency)
  2. Applies its wrapped callable
  3. Pushes the result to all downstream node input queues
# Abstract dataflow model (NOT real implementation)
async def node_execute(node):
    for input_queue in node.input_queues:
        value = await input_queue.get()
    result = node.func(*node.active_inputs)
    for downstream, port in node.downstream_connections:
        await downstream.push(result, port)

The graph execution is level-by-level: nodes are grouped into topological layers, and within each layer all nodes execute concurrently via asyncio.gather. Layers execute sequentially to respect data dependencies.

execute(Li)=⋀n∈Lifire(n)wherefire(n)=fn(inputs(n))→outputs(n)

Related Pages

Implemented By

Uses Heuristics

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment