feign-reactive icon indicating copy to clipboard operation
feign-reactive copied to clipboard

Support kotlin coroutines

Open IvanPavlov1995 opened this issue 4 years ago • 3 comments

I don't see any mentioning of kotlin coroutines adapter or something like that, does it exist? If it doesn't, it would be really great to have such integration

IvanPavlov1995 avatar May 20 '21 10:05 IvanPavlov1995

Unfortunately I'm not familiar with Kotlin. Can you make some draft hot it should look like? Are there any adapters for blocking feign client (aka OpenFeign)?

kptfh avatar May 24 '21 07:05 kptfh

I haven't seen such thing for blocking feign. Probably, that's because asynchronous nature of coroutines. I know that there is retrofit library implementation of something similar, here are some links about it https://github.com/square/retrofit/blob/master/CHANGELOG.md#version-260-2019-06-05 https://github.com/square/retrofit/blob/master/retrofit/src/main/java/retrofit2/HttpServiceMethod.java

It might be useful to look at kotlin coroutines library which provides an adapter to reactor: https://github.com/Kotlin/kotlinx.coroutines/tree/master/reactive/kotlinx-coroutines-reactor

Also spring-webflux support coroutines natively, so it might be useful to look there too.

If I understand everything correctly,

Mono<T> request1();

Flux<E> request2();

should become

suspend request1(): T

request2(): Flow<E>

IvanPavlov1995 avatar Jun 08 '21 10:06 IvanPavlov1995

add suspend support please, or is there an alternate?

hamza-maqsood avatar Jul 13 '21 10:07 hamza-maqsood