I have flow in my application thath groups request and send them in batch. Actually it is made with Flux.window operator, and I have question regarding this. How looks behaviour of window when application going to shut down ? Should I expect losted pushed events ? Or If I define timeout on window, then application will wait during window end and then shutdown ? Or maybe I could define some behaviour of app in such situation.
Thanks for any sugestions.
you can use the Disposable object received on subscribing the flux, to check if the flux window is completed or not.
Disposable subscribe = Flux.just(1, 2, 3)
.map(number -> {
Thread.sleep(1000);
return number;
})
.subscribe();
while (!subscribe.isDisposed() && count < 100) {
Thread.sleep(500);
count++;
System.out.println("Waiting......");
}
System.out.println("disposable:" + subscribe.isDisposed());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With