当前位置:网站首页>Using jhipster to build microservice architecture

Using jhipster to build microservice architecture

2022-06-23 03:34:00 Micro Stone

In this paper , We will look at code generation tools JHipster Microservice architecture generated and supported .

JHipster Is a code generation tool , It can be for Kubernetes establish Web Applications 、 Microservices 、 Deployment file 、 Cloud integration and CI/CD Jenkins file . This tool is very helpful for developers who can quickly generate code and avoid creating boilerplate code , Can save 30% The amount of work .

JHipster Support Spring Boot The back-end code and Angular/React/Vue.js Front end code in .

In this paper , We will study JHipster Microservice architecture generated and supported .

Microservices are independent 、 Modular deployable components , By business domain model 、 Scalable 、 Efficient and rapidly deployable business function splitting .

Microservices consist of several components , Including service registration 、 Service discovery 、 health examination 、 elastic 、 Fault tolerance and security .

JHipster The following microservice components are supported to complete the above components :

1. JHipster Registry: This is the service registry , Different microservices can be registered and found here . The registry also provides monitoring and health check dashboards .

JHipster Registry Based on the 2 Components :Netflix Eureka and Spring Cloud Config Server.

a、Netflix Eureka:Eureka Provide dynamic service registration and discovery .Eureka Maintains a central service registry , You can register a new microservice and take it off the shelf when the service goes down . The registry maintains up-to-date information about available services and their metadata . Sign up to Eureka The server's services send their heartbeats , When the client no longer sends heartbeat , The service will be removed from the registry .

Eureka Provide dynamic discovery , The client looks up the service registry to get service information , For example, the service of URL, And pass URL Connect .

b、Spring Cloud Config Server: This provides centralized storage for managing the properties and configurations of all microservices .

Microservices can be connected to cloud-config Service and get configuration details . Configuration services can also be exposed to Rest API.

2、HashiCorp Consul: Consul Is from HashiCorp Service discovery client for .Consul Provide service discovery for key value stores 、 Fault tolerance 、Vault. This is a JHipster Registry alternatives , It can provide service discovery and configuration storage .

Eureka Support with Spring Boot Written application services .Consul Can support the use of Java、Golang Or multiple clients written in other programming languages .

Consul Support multiple data centers out of the box . function Consul The node of runs a consul Agent to monitor the health of the service .

3. JHipster API gateway

JHipster Provide gateway , It is a single entry point to access services . The gateway provides the request 、 Response conversion 、API Security 、 cache 、 throttle 、 route 、 Filtering and fault tolerance .

JHipster The gateway is integrated for API Gateway function Zuul And for elastic and circuit breaker functions Hystrix. Because in the future will delete to Hystrix Support for , therefore JHipster Are looking for Resilience4J Integrated to achieve circuit breaker function .

Hystrix or Resilience4J Prevent cascading failures in distributed systems , Enable fallback service , Control system delay .

JHipster API Gateway Will work with JHipster Registry Use it together Spring Cloud Load Balancer Service discovery and load balancing HTTP request .

4. JHipster Control Center: The control center monitors and manages applications . The control center provides the following functions :

a、Instances: Instances Provides a list of application instances ; When services are in JHipster Registry Registration in China , The service is available in the instance list . It also provides a dashboard to view the list .

b. Metrics: The indicators are Micrometer management , The Micrometer Track system metrics , Such as JVM、HTTP request 、 Cache usage and database connections .

C、 health examination : Health examination and Spring Actuator Integration to get the health status of the service .

d、 journal : Journal and Logback Integrate , Logs for tracking running applications .

e. API file :API Documentation provides Swagger APIn file .

5. JWT The security of : JWT Is a stateless security mechanism , It can be extended to multiple servers . This is a JHipster Default security options for microservices .

JWT Provide Header、Payload and Signature. All client session data is stored in the token .JWT There is no server-side session management in .OAuth 2.0 Support JWT For secure transmission .

6. JHipster UAA Microservice security : JHipster UAA It's using OAuth2 User billing and authoring microservices .

OAuth2 Is an authorization framework that can be used for centralized identity management .JHipster UAA Provides a OAuth2 Endpoint , The endpoint provides an access token based on authentication . Tokens provide fine-grained access control to access information based on Rest Service for .UAA It is a combination of authorization server and resource server .

Example OAuth The process is as follows :

Use JHipster The instance architecture generated for the microservice is as follows :

This paper introduces JHipster Different microservice components supported , Let you know how to use JHipster Build the microservices architecture . Thank you for reading !

原网站

版权声明
本文为[Micro Stone]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202211734210481.html