Differences between netflix.feign & openfeign

Optimal Prime picture Optimal Prime · Apr 13, 2018 · Viewed 13.4k times · Source

Introduction

I recently used netflix feign along with ribbon which was quite useful.

An Example of this is:

@FeignClient(name = "ldap-proxy")
public interface LdapProxyClient  { 
    @RequestMapping(path = "/ldap-proxy/v1/users/{userNameOrEMail}", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
    LdapUser search(@PathVariable("userNameOrEMail") String userNameOrEMail);
}

However, at some point I thought that instead of having to code all these definitions by hand (for an existing webservice), that I should see if a tool existed.

I stumbled across https://github.com/swagger-api/swagger-codegenand saw that there are examples in which clients are generated, e.g. https://github.com/swagger-api/swagger-codegen/tree/master/samples/client/petstore/java/feign .

However, once I looked closely at the imports I noticed the following:

import feign.Feign;

Netflix's opensource solution on the other hand has package names: org.springframework.cloud.netflix.feign.

Additionally, I noticed that both use ribbon if available, but Netflix's notation is much cleaner with a lot happenning in the background. E.g. the @FeignClient annotation class javadoc states:

  • Annotation for interfaces declaring that a REST client with that interface should be * created (e.g. for autowiring into another component). If ribbon is available it will be * used to load balance the backend requests, and the load balancer can be configured * using a @RibbonClient with the same name (i.e. value) as the feign client.

However in the Feign.feign documentation (at https://github.com/OpenFeign/feign ) I see:

RibbonClient overrides URL resolution of Feign's client, adding smart routing and resiliency capabilities provided by Ribbon.

Integration requires you to pass your ribbon client name as the host part of the url, for example myAppProd.

> MyService api =
> Feign.builder().client(RibbonClient.create()).target(MyService.class,
> "https://myAppProd");

So my questions are:

  1. what is the history/relationship and differences between the two?
  2. what are the pros and cons of each?

Are they completely different projects with no relation, or did netflix just fork/utilize OpenFeign and modify it to be within their integrated cloud solution? Essentially, did netflix just acquire and integrate different technologies like Discovery, ribbon, and feign from open-source projects?

Answer

Paulo Merson picture Paulo Merson · Sep 17, 2018

"Netflix feign" is the old project designation. The last version (dependency below) is dated July 2016.

compile group: 'com.netflix.feign', name: 'feign-core', version:'8.18.0'   // OLD

"Open feign" is the new project designation. It's the same project, but was moved to a different git repo and got a new group-id. Its versions start at 9.0.0.

compile group: 'io.github.openfeign', name: 'feign-core', version: '10.0.1'   // NEW

See this github issue for a brief history of what happened. Most remarkably, you'll find out that Feign isn't used internally at Netflix anymore. :^o