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

Multi onComplete* operators #1806

Merged
merged 3 commits into from
May 15, 2020

Conversation

danielkec
Copy link
Contributor

@danielkec danielkec commented May 15, 2020

Effectively append to the stream with onCompleteResume

  • Multi.onCompleteResume
        List<Integer> result = Multi.just(1, 2, 3)
                .onCompleteResume(4)
                .onCompleteResume(5)
                .collectList()
                .await();

        assertThat(result, is(equalTo(List.of(1, 2, 3, 4, 5))));
  • Multi.onCompleteResumeWith
        List<Integer> result = Multi.just(1, 2, 3)
                .onCompleteResumeWith(Multi.just(4, 5, 6))
                .collectList()
                .await();

        assertThat(result, is(equalTo(List.of(1, 2, 3, 4, 5, 6))));

Methods common for Multi and Single are accessible at common ancestor Subscribable

        Subscribable<Integer> subs = Single.just(1);

        subs = subs.onCompleteResume(2);

        List<Integer> result = Multi.from(subs)
                .collectList()
                .await();

        assertThat(result, is(equalTo(List.of(1, 2))));

Concat has varargs

assertThat(Multi
                        .concat(Multi.from(TEST_DATA_1),
                                Multi.just(TEST_DATA_2),
                                Multi.just(TEST_DATA_3),
                                Multi.just(TEST_DATA_4),
                                Multi.just(TEST_DATA_5),
                                Multi.just(TEST_DATA_6)
                        )
                        .collectList()
                        .await(),
                is(equalTo(flatMap.apply(List.of(
                        TEST_DATA_1,
                        TEST_DATA_2,
                        TEST_DATA_3,
                        TEST_DATA_4,
                        TEST_DATA_5,
                        TEST_DATA_6
                )))));

Signed-off-by: Daniel Kec daniel.kec@oracle.com

  * Multi.onCompleteResume
  * Multi.onCompleteResumeWith

Signed-off-by: Daniel Kec <daniel.kec@oracle.com>
@danielkec danielkec self-assigned this May 15, 2020
@danielkec danielkec added the reactive Reactive streams and related components label May 15, 2020
Signed-off-by: Daniel Kec <daniel.kec@oracle.com>
Signed-off-by: Daniel Kec <daniel.kec@oracle.com>
Copy link
Member

@tomas-langer tomas-langer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@danielkec danielkec merged commit 0325cae into helidon-io:master May 15, 2020
tomas-langer added a commit to tomas-langer/helidon that referenced this pull request May 17, 2020
Changed generic declaration in API to be more open for users.

Signed-off-by: Tomas Langer <tomas.langer@oracle.com>
tomas-langer added a commit that referenced this pull request May 18, 2020
* JSON-P stream writer and related changes.
* Updated according to changes in #1806.

Signed-off-by: Tomas Langer <tomas.langer@oracle.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reactive Reactive streams and related components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants