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 Source#create method #1626

Open
He-Pin opened this issue Dec 23, 2024 · 0 comments
Open

Feature request: Add Source#create method #1626

He-Pin opened this issue Dec 23, 2024 · 0 comments
Labels
t:stream Pekko Streams

Comments

@He-Pin
Copy link
Member

He-Pin commented Dec 23, 2024

Motivation:
Even currently, we have Source#unfold and Source#queue, which is still a bit different from the Reactor's Flux#create method.

When we want to control progress, we still make it lazy. btw, the behavior seems to be expressed with Source#lazySource and Source#queue.

I think the logic should not be that hard to implement but will make users' lives much easier.

refs: https://projectreactor.io/docs/core/release/reference/coreFeatures/programmatically-creating-sequence.html#producing.create

Flux<String> bridge = Flux.create(sink -> {
    myEventProcessor.register(
      new MyEventListener<String>() {

        public void onDataChunk(List<String> chunk) {
          for(String s : chunk) {
            sink.next(s);
          }
        }

        public void processComplete() {
            sink.complete();
        }
    });
});
@He-Pin He-Pin added the t:stream Pekko Streams label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t:stream Pekko Streams
Projects
None yet
Development

No branches or pull requests

1 participant