Synchronous REST Communication — Concept Check
Questions on Synchronous REST Communication. REST over HTTP is the most common inter-service protocol; use OpenFeign or RestTemplate/WebClient with service discovery to call downstream services.
Questions in this quiz
8 questions on Synchronous REST Communication — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A microservice using OpenFeign is experiencing slow responses from the 'product-service'. What should you check first?
- ACheck if the circuit breaker is open for 'product-service'.
- BInspect the network latency between services.
- CEnsure the WebClient is configured with a timeout.
- DVerify if the Feign client is using the correct service name.
2.You are using WebClient for a service call, but the application hangs indefinitely. What might be the issue?
- AThe WebClient is missing the @LoadBalanced annotation.
- BThe service name in Eureka is incorrect.
- CWebClient is not configured with a timeout.
- DThe Feign client is not enabled with @EnableFeignClients.
3.When using OpenFeign with Eureka, what is a common mistake that can lead to service discovery failures?
- AForgetting to enable Feign clients with @EnableFeignClients.
- BUsing WebClient instead of RestTemplate.
- CNot configuring Resilience4j circuit breaker.
- DNot annotating the Feign client interface with @FeignClient.
4.A developer claims that WebClient is always non-blocking. Is this true?
- AYes, WebClient is designed to be non-blocking.
- BYes, but only when used with @LoadBalanced.
- CNo, WebClient is blocking by default.
- DNo, WebClient can be blocking if not properly configured.
5.What is an advantage of using OpenFeign over RestTemplate in microservices?
- AOpenFeign supports declarative interfaces and integrates with Eureka.
- BOpenFeign does not require any configuration.
- CRestTemplate does not support service discovery.
- DOpenFeign is faster than RestTemplate for all use cases.
6.You notice high thread usage in a service using RestTemplate. What could be a potential cause?
- AThe Feign client is missing the fallback method.
- BOpenFeign is not configured with a circuit breaker.
- CThe service is not using @LoadBalanced with WebClient.
- DRestTemplate is blocking, leading to high thread usage.
7.A service using WebClient with @LoadBalanced is experiencing high failure rates. What could be a reason?
- AThe service is not using Resilience4j circuit breakers.
- BRestTemplate is being used instead of WebClient.
- CWebClient is inherently unreliable.
- DThe Feign client is not configured with a fallback.
8.What is the purpose of the @FeignClient annotation in OpenFeign?
- AIt configures WebClient with service discovery.
- BIt sets timeouts for Feign clients.
- CIt enables non-blocking calls in RestTemplate.
- DIt maps Java methods to HTTP endpoints for a specified service.