New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add feign client to api-gateway #74

Open
wants to merge 5 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@secret-lain

secret-lain commented Apr 24, 2018

No description provided.

secret-lain added some commits Apr 24, 2018

[api-gateway] add feign client
- as-is = controller <-> serviceClient
- to-be = controller <-> service <-> feignClient
@mszarlinski

This comment has been minimized.

Collaborator

mszarlinski commented May 1, 2018

Thanks for your contribution, please answer my comments. @arey could you look on it?

@arey

This comment has been minimized.

Contributor

arey commented May 1, 2018

@mszarlinski I'm not familiar with Feign Rest client. In a microservices architecture, it is a real alternative to the Spring RestTemplate? What are the benefits?

@secret-lain

This comment has been minimized.

secret-lain commented May 2, 2018

I do not think you should replace it.
But feign client is more abstraction than RestTemplate and I think it is more readable structure.
If netflix opensource such as hystrix is added in the future, I think it will be more flexible.

public interface VisitsServiceFeignClient {
@GetMapping("/owners/{ownerId}/pets/{petId}/visits")
List<VisitDetails> getVisitDetails(@PathVariable("ownerId") final int ownerId, @PathVariable("petId") final int petId);

This comment has been minimized.

@mszarlinski

mszarlinski Jul 7, 2018

Collaborator

You could provide a fallback for this method

/**
* @author lain
*/
@FeignClient("customers-service")

This comment has been minimized.

@mszarlinski

mszarlinski Jul 7, 2018

Collaborator

Is this client “load-balanced” by Ribbon?

This comment has been minimized.

@Dovchiproeng

Dovchiproeng Jul 8, 2018

Spring cloud document did state this

In the @FeignClient annotation the String value ("stores" above) is an arbitrary client name, which is used to create a Ribbon load balancer (see below for details of Ribbon support). You can also specify a URL using the url attribute (absolute value or just a hostname). The name of the bean in the application context is the fully qualified name of the interface. To specify your own alias value you can use the qualifier value of the @FeignClient annotation.

Hope it help with your question.

import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import static java.util.stream.Collectors.*;

This comment has been minimized.

@mszarlinski

mszarlinski Jul 7, 2018

Collaborator

Please unroll wildcard imports

@arey

This comment has been minimized.

Contributor

arey commented Aug 31, 2018

@secret-lain do you plan to take into account @mszarlinski comments?

@arey arey added the enhancement label Sep 28, 2018

@arey

This comment has been minimized.

Contributor

arey commented Nov 18, 2018

Conflicting file comes from the PR #114. Hystrix circuit breaker has been added with a fallback if the visits-service is unavailable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment