<https://kotlinlang.slack.com/archives/C0B8RC352/p...
# ktor
e
You could run multiple async requests with ktor:
Copy code
val results = listOf(
   async { client.get<String>(...) },
   async { client.get<String>(...) }
).awaitAll()
t
Yeah, this is what I mean by “using the ktor client”. But it would be nice if I could still use Hystrix for circuit breaking and metrics and stuff like this
r
There is a small dsl called kystrix for that maybe it will be useful that you can combine your requests with that http://code.haleby.se/2018/09/16/kystrix-a-kotlin-dsl-for-hystrix/
🤔 1
By the way @e5l think Ktor needs some support for microservices. Which I belive change the game 🙂
I could not see any. Is there any?
f
@Tim Büthe you might want to check out https://github.com/resilience4j/resilience4j no kotlin wrapper, but it's built around FP and should be pretty easy to integrate
👏 1
t
I would guess resilience4j is also starting threads, right?
My question is this: Wouldn’t all the great performance gains we get from coroutines not being destroyed if every request is done in a thread anyways?
e
It depends on how you run the task
f
I think there's a non-thread option from looking at the resilience4j circuitbreaker docs: http://resilience4j.github.io/resilience4j/#_circuitbreaker
Copy code
You can decorate any Supplier / Runnable / Function or CheckedRunnable / CheckedFunction function with CircuitBreaker.decorateCheckedSupplier(), CircuitBreaker.decorateCheckedRunnable() or CircuitBreaker.decorateCheckedFunction().
probably want to confirm, but the
supplier
variant probably/might run in the same thread
yep, looks like the supplier variant does what you want
r
@fitzoh I did not know resilience4j thanks
👍 1