Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static void main(String[] args) throws Exception {
*/
private static Mono<Void> generateEvents(AtomicBoolean isRunning) {
final Logger logger = LoggerFactory.getLogger("Producer");
final Scheduler scheduler = Schedulers.newElastic("produce");
final Scheduler scheduler = Schedulers.elastic();
final Duration operationTimeout = Duration.ofSeconds(5);
final String[] machineIds = new String[]{"2A", "9B", "6C"};
final Random random = new Random();
Expand Down Expand Up @@ -129,10 +129,11 @@ private static Mono<Void> generateEvents(AtomicBoolean isRunning) {
return client.send(batch);
}).block(operationTimeout);
}
}).doFinally(signal -> {
logger.info("Disposing of producer.");
client.close();
}).subscribeOn(scheduler);
}).subscribeOn(scheduler)
Copy link
Member

Choose a reason for hiding this comment

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

Does the order of subscribeOn() matter?

Copy link
Member Author

Choose a reason for hiding this comment

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

According to this, order doesn't matter.
https://stackoverflow.com/a/37986481/4220757

.doFinally(signal -> {
logger.info("Disposing of producer.");
client.close();
});
}
}

Expand Down