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

Make imperative Consumer composable with a reactive Supplier<Flux<?>> #1141

Closed
artembilan opened this issue May 2, 2024 · 0 comments
Closed
Assignees
Milestone

Comments

@artembilan
Copy link
Contributor

With Spring Cloud Function we can simply make a composition like this: supplier|consumer. It is even composed when Supplier<Flux<?>> and when we do this:

Runnable composedFunction = functionCatalog.lookup(null);
composedFunction.run();

Everything is OK, but consumer does not really consume the Flux returned from the supplier.

To make it working we need a special wrapper around imperative consumer:

@Bean
Consumer<Flux<Message<?>>> fluxWrapperConsumer(@Qualifier("myConsumer") Consumer<Message<?>> myConsumer) {
	return messageFlux -> messageFlux.doOnNext(myConsumer).subscribe();
}

And then compose a reactive supplier with this one already.

The idea of this request is to have an automatic wrapping in the Spring Cloud Function when it composes reactive suppliers with imperative consumers.

@olegz olegz self-assigned this May 3, 2024
@olegz olegz added this to the 4.1.2 milestone May 3, 2024
@olegz olegz modified the milestones: 4.1.2, 4.2 May 30, 2024
@artembilan artembilan changed the title Make implerative Consumer composable with a reactive Supplier<Flux<?>> Make imperative Consumer composable with a reactive Supplier<Flux<?>> Jun 5, 2024
@olegz olegz closed this as completed in 6ffae93 Jun 6, 2024
@olegz olegz modified the milestones: 4.2, 4.1.3 Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants