Reactive programming is not simply about composing asynchronous operations. Understanding execution boundaries, maintaining contextual information, and controlling failure propagation are what make a reactive application predictable and maintainable.
1. Introduction: Beyond Mono and Flux
Consider a Spring WebFlux payment service. A request arrives, the service loads customer information, calls an external payment gateway, and persists the transaction. The pipeline is a handful of chained operators, and in development it behaves exactly as expected.
Production is less forgiving. A legacy client quietly blocks an event-loop thread, and throughput collapses under moderate load. A correlation ID that was present in the controller is null in the log line three operators later. An exception you expected to be handled propagates straight to the client. A retry fires, and the customer is charged twice.…