Skip to main content

Posts

Showing posts with the label Reactive Programming

Ignoring Cancel Signals and Continuing Processing in a Spring WebFlux App

In a  Spring WebFlux  application, request processing is reactive, meaning that when a client  cancels a request  (e.g., due to a timeout or manual cancellation),  Spring immediately stops execution  by propagating a  cancel signal  in the reactive stream. However, in some cases,  we want to ensure that processing continues , even if the client disconnects. This is especially important when: Database updates  or  external API calls  must be completed to avoid an inconsistent state. Long-running operations should  not be interrupted . Logging, auditing, or side effects must still be processed. How to Keep Processing After a Cancel Signal To  decouple  HTTP request processing from the  application logic , we can use the  .cache()  operator. This ensures that the  execution continues , even if the client drops the connection. Understanding  .cache()  in Reactor <T> Flux...