Vert.x Microservice Blueprint | Some changes && refactoring
Some of the unecessary components has been removed:
- Payment Microservice: The logic should be refactored in order to fit for real production logic.
As suggested by Clement and Paulo, I use HTTP-HTTP pattern for API Gateway eventually. The API gateway itself is using HTTPS, but it communicates REST endpoints via HTTP.
So the API Gateway is responsible for:
- Dispatching requests to corresponding endpoint.
How to implement this?
My solution: When publishing endpoints to the service discovery infrasture, every endpoints must provide an
api-nameto identify the api, then when a request arrives from the gateway, the gateway will get the prefix pattern
/api/:name/*and find any corresponding endpoints via discovery, then consume the HTTP endpoint.
- Simple load balancing
- Health check
- Failure handling (using Vert.x Circuit Breaker)
- Global auth state storage(in route context and session scope)
It’s convenient to use Keycloak via Vert.x OAuth2.