backpressure

Explain and demonstrate Reactive Streams backpressure with Java ArrayPublisher implementation.

1|Updated Jan 30, 2026
One-click install
npx skills add https://github.com/jaeyeonling/simple-reactive-streams --skill backpressure
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backpressure
Source: https://github.com/jaeyeonling/simple-reactive-streams/tree/main/.opencode/skills/backpressure
Command: npx skills add https://github.com/jaeyeonling/simple-reactive-streams --skill backpressure

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the critical challenge in reactive programming where a fast data producer can overwhelm a slow data consumer, leading to performance issues or crashes. It provides a clear understanding and implementation guide for Backpressure.

Core Features & Use Cases

  • Backpressure Fundamentals: Explains the concept of Backpressure and contrasts Push vs. Pull models.
  • request(n) Mechanism: Details how request(n) controls data flow and manages demand.
  • Backpressure Strategies: Demonstrates implementations for Buffer, Drop Oldest, Drop Latest, Error, and Block strategies.
  • Example Implementation: Provides a working ArrayPublisher with Backpressure handling.
  • Use Case: Implementing a data processing pipeline where a network stream (fast producer) feeds data to a disk writer (slow consumer), ensuring the system remains stable and data is not lost.

Quick Start

Understand how to implement a BufferedSubscription to handle backpressure by requesting data only when the subscriber is ready.

Frequently Asked Questions about backpressure

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is backpressure in reactive streams and why is it needed?

Backpressure in reactive streams prevents a fast data producer from overwhelming a slow consumer. It manages data flow to avoid performance degradation or crashes when consumption rates cannot match production rates.

How does the request(n) mechanism control demand in a Java subscriber?

The request(n) mechanism allows a subscriber to specify exactly how many items it can process. This signals the publisher to emit only that number of elements, managing demand and preventing overload.

How do I implement a custom publisher with backpressure handling in Java?

You can implement a custom publisher by creating an ArrayPublisher that tracks subscriber demand, manages data emission, and handles cancellation according to the reactive streams specification.

What backpressure strategies can I use when a subscriber is slow?

Available backpressure strategies include buffering items, dropping the oldest or latest items, throwing an error, or blocking the producer until the consumer catches up.

How do I handle a fast network stream feeding a slow disk writer in reactive programming?

Implement a data processing pipeline using backpressure to request data only when the slow disk writer is ready. This ensures system stability and prevents data loss during consumption.