Reputation: 13
I am new to feign client implementation , i have following code for current implementation .
FeignPaymentAbcService:
@FeignClient(name= "abc-service", url="abc url")
public interface FeignPaymentAbcService{
//methods
}
invoking call :
(feignPaymentAbcService.someFunctionality("some input")).getBody();
In future there is possibility of multiple feign services like feignPaymentAbcService ,feignPaymentxyz Service etc so according to service it should get feign client name and url in which service is running. Basically want to make in dynamic way.
Can anybody suggest any approach ?
Upvotes: 0
Views: 1675
Reputation: 46
You can use the Feign along with Ribbon and Eureka server for dynamically getting the url along with the server( or list of urls depending on instances)
@FeignClient(name= "abc-service")
@RibbonClient(name = "abc-service")
but the name has to be there so that the particular service is identified from the app.properties file. You need to add corresponding dependencies for eureka server & Ribbon Load balancer and you need to configure them in application.properties
You can lookup my sample code here
Upvotes: 3