Last active
December 11, 2018 21:21
-
-
Save haigopi/e8b8410739c9077b90818224c6396b1a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@Slf4j | |
public class FluxPublishTest { | |
@Test | |
public void test() { | |
Scheduler scheduler = Schedulers.immediate(); | |
Flux.range(1, 5) | |
.map(n -> Mono.just(n).publishOn(scheduler).map(k -> process(k)) | |
.thenEmpty(m -> log.info("Job Done")).subscribe()).subscribe(); | |
} | |
public Mono<Object> process(Object n) { | |
log.info("Processing : {}", n); | |
return Mono.empty(); | |
} | |
} | |
15:21:22.753 [main] DEBUG reactor.util.Loggers$LoggerFactory - Using Slf4j logging framework | |
15:21:22.906 [main] INFO com.capitalone.fs.marketingone.FluxPublishTest - Processing : 1 | |
15:21:22.909 [main] INFO com.capitalone.fs.marketingone.FluxPublishTest - Job Done | |
15:21:22.910 [main] INFO com.capitalone.fs.marketingone.FluxPublishTest - Processing : 2 | |
15:21:22.910 [main] INFO com.capitalone.fs.marketingone.FluxPublishTest - Job Done | |
15:21:22.910 [main] INFO com.capitalone.fs.marketingone.FluxPublishTest - Processing : 3 | |
15:21:22.910 [main] INFO com.capitalone.fs.marketingone.FluxPublishTest - Job Done | |
15:21:22.912 [main] INFO com.capitalone.fs.marketingone.FluxPublishTest - Processing : 4 | |
15:21:22.912 [main] INFO com.capitalone.fs.marketingone.FluxPublishTest - Job Done | |
15:21:22.912 [main] INFO com.capitalone.fs.marketingone.FluxPublishTest - Processing : 5 | |
15:21:22.912 [main] INFO com.capitalone.fs.marketingone.FluxPublishTest - Job Done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment