Reactive Streams · interview question
When using Project Reactor's Flux, which method can be used to handle a scenario where data production exceeds the subscriber's consumption rate?
Multiple choiceHardchapter-19-curatedpremiumreactive-streamsbackpressure-strategies
Flux.range(1, 10).onBackpressureBuffer(5);Answer and explanation
Correct answer
D. OnBackpressureBuffer
Why
The onBackpressureBuffer method buffers incoming data when the subscriber is slow, preventing data loss by storing the excess elements until they can be processed.
Test yourself on Reactive Streams
A free test with instant, explained results. No account needed.
More Reactive Streams questions
- Which backpressure choice is usually most acceptable for a live price-ticker UI that only needs the newest value?
- Why can using onBackpressureDrop in a high-throughput system become a problem in production code?
- In Reactive Streams, what does a Publisher do?
- How does Project Reactor's Flux handle backpressure by default?
- How would you explain a key benefit of applying backpressure in a Reactive Streams system in an interview?
- In a non-blocking system using Reactive Streams, why is blocking the event loop a concern?