Quantcast
Channel: Akka Libraries - Discussion Forum for Akka technologies
Viewing all articles
Browse latest Browse all 1365

Akka streams graph stage stuck if onPull doesn't push

$
0
0

Hi all,

I’m developing a custom Akka source using GraphStage in Java.
I’m noticing that if during onPull(), no element is pushed, the stage is stuck.
Is my understanding incorrect that onPull() should be called again if no element was pushed?

Thanks!

{
                setHandler(out, new AbstractOutHandler() {
                    @Override
                    public void onPull() throws Exception {
                        if (count++ > 1000) {
                            completeStage();
                            return;
                        }
                        if (count % 2 != 0) {
                            Integer n = rand.nextInt(100);
                            buffer.add(n);
                            push(out, n);
                        } else {
                            // if this block is entered, source will be stuck
                            return;
                        }
                    }
                });
            }

5 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 1365

Trending Articles