Last active
July 28, 2020 11:31
-
-
Save davidbilge/1cd1c812658160526a4cc14f21bf78c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package de.cronos.mad.messages.backend; | |
import java.util.function.Supplier; | |
import org.junit.jupiter.api.Test; | |
import reactor.core.publisher.DirectProcessor; | |
import reactor.core.publisher.Mono; | |
import reactor.core.scheduler.Schedulers; | |
public class RepeatTest { | |
private static class TestSubject { | |
public void logMonoValues(Supplier<Mono<String>> monoSupplier) { | |
Mono.defer(monoSupplier).repeat().subscribe(System.out::println); | |
} | |
} | |
@Test | |
public void repeatTest() { | |
DirectProcessor<String> testPublisher = DirectProcessor.create(); | |
TestSubject testSubject = new TestSubject(); | |
testSubject.logMonoValues(() -> Mono.from(testPublisher)); | |
testPublisher.onNext("Hello"); | |
testPublisher.onComplete(); | |
testPublisher.onNext("World"); | |
testPublisher.onComplete(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment