idea: retrofeign
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.8k
- Forks
- 1.9k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 41
Description
"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?
cc @jakewharton @swankjesse
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proposed RetroFeign builder and Feign's existing contract parsing, then read Retrofit's retrofit/src/main/java/retrofit2/CallAdapter.java and the linked call-adapter design. Determine whether Retrofit call adapters can be reused with Feign's interfaces and document the supported async types and integration scope; the issue is complete only when that design is validated and an implementation path is agreed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100