OpenFeign / OpenFeign/feign

idea: retrofeign

Open
#644 16 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

proposal waiting for votes
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.