Alfy
03/21/2022, 6:40 PMEmil Kantis
03/21/2022, 8:57 PMSaharath Kleips
03/22/2022, 4:28 PMlaunch
as well as Spring WebFluxAlfy
03/22/2022, 4:28 PMAlfy
03/22/2022, 4:29 PMSzymon Jeziorski
03/22/2022, 7:00 PMfun sampleApiCallThatReturnsMono(): Mono<ApiResponse> {
...
}
suspend fun webClientWithCoroutineExtension(): ApiResponse =
client.[...].retrieve().awaitBody()
suspend fun parallelCalls() = coroutineScope {
val call1 = async { sampleApiCallThatReturnsMono().awaitSingle() }
val call2 = async { webClientWithCoroutineExtension() }
println("Call 1 result: ${call1.await()}, Call 2 result: ${call2.await()}")
}
suspend fun multipleFireAndForgetCalls() = coroutineScope {
repeat(10) {
launch { webClientWithCoroutineExtension() }
}
}