I'm quite new to Feign. Just discover it today ... My first question when i read about Spring Cloud Feign is : "how do you package your feign client ?"
I'm taking an example. Suppose we have 2 microservices M1 and M2. M2 consume a endpoint from M1.
We can for example, build 2 jars for M1 :
In this solution, I saw an analogy with EJB2 stub and skeleton parts. And I saw another possible advantage : the Feign client is always in sync (v1) with the implementation (v1).
or do you only declare the Feign client inside the M2 microservices. That is if a third microservice need M1, it will also declare a Feign client (that can be a little different because its needs are different).
Perhaps I'm totally wrong, please correct me.
Thanks a lot ! Bye
The main idea behind Feign is only getting a rest client for your Microservice, and of course, it should be in sync with the exposed service
With this info in mind:
do you only declare the Feign client inside the M2 microservices. - Yes, your M2 should declare a dependency on it to consume the exposed service by M1
That is if a third microservice need M1, it will also declare a Feign client (that can be a little different because its needs are different). - I don't think so, the client should be the same all the time, it could be different only if your API rest has changed, otherwise, all feign clients should be the same