idea: retrofeign
See original GitHub issue“retrofeign” retrofits … retrofit’s async layer onto feign
This project has a lot of users, and needs some help I think. What if we tried to leverage code that has a nice design to extend the life a bit.
My theory is that we could make “retrofeign” which would allow the same contract parsing that feign existing users have, but be able to employ retrofit async layering (ex rxjava)
Ex. it would look like…
Feign feign = RetroFeign.builder()
... // normal things
.callAdapterFactory(RxJava2CallAdapterFactory.create())
.target(MyService.class, "https://example.com");
interface MyService {
@RequestLine("GET /user")
Observable<User> getUser();
}
The call adapter factory won’t always be portable as it relies on Retrofit. However the code there is relatively straightforward, and some of the call adapters don’t actually use the retrofit instance at all. At any case I think we could reuse the Call adapters with less effort than starting something from scratch.
https://github.com/square/retrofit/blob/master/retrofit/src/main/java/retrofit2/CallAdapter.java
It might not work, but seems like a good way to provide sustainable options to people. For example, when using okhttp client we could use this to reasonably easily create guava rxjava or other types of async things.
thoughts?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:16 (8 by maintainers)
@velo and @kptfh, I see that you have a number of classes that are part of feign-core copied and replicated in feign-reactive-core. I think we should refactor those out so that feign-reactive-core can stay in sync with feign-core. I’m going to take a stab at this and I’ll create a PR for you all to review.
In addition, we do still have some housekeeping to do on the project, we need to enable travis and configure it to deploy once we have a release ready.
I look at the PR, I was thinking… may be, the default implementation should be only dealing with
Future
and then we could have reactive implementation forreactor
,Callbacks
and other possible implementations… how does that feel?