i want to create a microservice in Springboot that calls (with Feign client or WebClient) other rest microservices.
For Example:
GET Detail Product microservices
Feign remote sub-call number 1 for user data dto response
Feign remote sub-call number 2 for contract data dto response
Feign remote sub-call number 3 for registry office data dto response
if only one of this sub-calls response with http error (500-502...), the microservice response with ko.
What is best practice and the powerfull library for manage this case? RxJava?
Thank you Alex
I got the same problem with my current task.
Here is my simple solution.
ExecutorService
https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html
I write my own worker to do sub-call and handle result/error in each worker.
You can write your worker by implement Runnable or Callable which is depend on your purpose.
If any errors in worker, i decide to return error code (5xx)... or timeout...
Otherwise, the service is OK.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.