Created
October 28, 2019 14:46
-
-
Save jkschneider/def8ecbd5c5c652246ebff26dfc7e53e 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
WebClient client = WebClient.builder() | |
.baseUrl("http://" + args[0]) | |
.build(); | |
Flux | |
.generate(AtomicLong::new, (state, sink) -> { | |
long i = state.getAndIncrement(); | |
sink.next(i); | |
return state; | |
}) | |
.limitRate(1) | |
.flatMap(n -> client.get().uri("/MYENDPOINT").exchange()) | |
.doOnNext(resp -> { | |
if (resp.statusCode().is2xxSuccessful()) | |
counter.increment(); | |
}) | |
.blockLast(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Disclaimer: Gatling author here
Hi,
Regards