Created
December 12, 2018 19:43
-
-
Save haigopi/6a061ac536d06615a438aa1db6370dd6 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.single(); | |
Flux.range(1, 6) | |
.parallel() | |
.runOn(scheduler) | |
.map(p -> { | |
process(p); | |
log.info("Job Done: {}", p); | |
return p; | |
}) | |
.sequential() | |
.subscribe(); | |
log.info(" Thread Done: {}", Thread.currentThread().getName()); | |
} | |
public int process(Integer n) { | |
log.info("Processing : {}", n); | |
return n; | |
} | |
} | |
13:42:36.356 [main] DEBUG reactor.util.Loggers$LoggerFactory - Using Slf4j logging framework | |
13:42:36.447 [single-1] INFO com.capitalone.fs.marketingone.FluxPublishTest - Processing : 1 | |
13:42:36.447 [main] INFO com.capitalone.fs.marketingone.FluxPublishTest - Thread Done: main | |
13:42:36.448 [single-1] INFO com.capitalone.fs.marketingone.FluxPublishTest - Job Done: 1 | |
13:42:36.448 [single-1] INFO com.capitalone.fs.marketingone.FluxPublishTest - Processing : 2 | |
13:42:36.450 [single-1] INFO com.capitalone.fs.marketingone.FluxPublishTest - Job Done: 2 | |
13:42:36.450 [single-1] INFO com.capitalone.fs.marketingone.FluxPublishTest - Processing : 3 | |
13:42:36.451 [single-1] INFO com.capitalone.fs.marketingone.FluxPublishTest - Job Done: 3 | |
13:42:36.451 [single-1] INFO com.capitalone.fs.marketingone.FluxPublishTest - Processing : 4 | |
13:42:36.451 [single-1] INFO com.capitalone.fs.marketingone.FluxPublishTest - Job Done: 4 | |
13:42:36.451 [single-1] INFO com.capitalone.fs.marketingone.FluxPublishTest - Processing : 5 | |
13:42:36.451 [single-1] INFO com.capitalone.fs.marketingone.FluxPublishTest - Job Done: 5 | |
13:42:36.451 [single-1] INFO com.capitalone.fs.marketingone.FluxPublishTest - Processing : 6 | |
13:42:36.451 [single-1] INFO com.capitalone.fs.marketingone.FluxPublishTest - Job Done: 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment