Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a reactive CommandLineRunner variant #10116

Closed
bclozel opened this issue Aug 30, 2017 · 1 comment
Closed

Add a reactive CommandLineRunner variant #10116

bclozel opened this issue Aug 30, 2017 · 1 comment
Assignees
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@bclozel
Copy link
Member

bclozel commented Aug 30, 2017

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 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.

We could create something like:

@FunctionalInterface
public interface ReactiveCommandLineRunner {
  Mono<Void> run(String... args);
}

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:

firstMono.concatWith(secondMono).then().block();
@bclozel bclozel added for: team-attention An issue we'd like other members of the team to review priority: normal type: enhancement A general enhancement labels Aug 30, 2017
@bclozel bclozel self-assigned this Aug 30, 2017
@bclozel bclozel added status: declined A suggestion or change that we don't feel we should currently apply and removed for: team-attention An issue we'd like other members of the team to review labels Sep 1, 2017
@bclozel
Copy link
Member Author

bclozel commented Sep 1, 2017

Declining this for now - this is more a usability issue about Reactive types.

@bclozel bclozel closed this as completed Sep 1, 2017
@bclozel bclozel removed priority: normal type: enhancement A general enhancement labels Sep 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

1 participant