You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spring Boot provides a functional interface CommandLineRunner for running tasks.
The method signature works well for blocking operations, but can lead to user errors if it's used with a reactive library.
I've seen a lot of code samples out there just calling Flux.subscribe(Consumer) in a CommandLineRunner.run call — this won't guarantee that the processing of that Flux is done before the application is shut down/the webapp is started.
See discussion in #9761.
Spring Boot provides a functional interface
CommandLineRunner
for running tasks.The method signature works well for blocking operations, but can lead to user errors if it's used with a reactive library.
I've seen a lot of code samples out there just calling
Flux.subscribe(Consumer)
in aCommandLineRunner.run
call — this won't guarantee that the processing of that Flux is done before the application is shut down/the webapp is started.We could create something like:
We could run all of those in parallel, or, at processing time, we could concat all of them (to guarantee a processing order) and block, like:
The text was updated successfully, but these errors were encountered: