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

Feature Request: Add Flow#transform method? #1453

Open
He-Pin opened this issue Aug 26, 2024 · 0 comments
Open

Feature Request: Add Flow#transform method? #1453

He-Pin opened this issue Aug 26, 2024 · 0 comments

Comments

@He-Pin
Copy link
Member

He-Pin commented Aug 26, 2024

Motivation:

Using an inline transform method can get more fluent code as Flux.
When using reactor-core 's Flux, we have something like:

        sink.asFlux()
            .onBackpressureBuffer()
            .transform(new MsgTransformer())
            .subscribe(msgs -> {
... }

And the transform method is just a syntax sugar:

	public final <V> Flux<V> transform(Function<? super Flux<T>, ? extends Publisher<V>> transformer) {
		if (Hooks.DETECT_CONTEXT_LOSS) {
			transformer = new ContextTrackingFunctionWrapper(transformer);
		}
		return onAssembly(from(transformer.apply(this)));
	}

WDYT?

Result:
More fluent code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant