HP-SOA - a fully functional, easy-to-use, highly scalable Java microservices framework.
- Project homepage: http://www.oschina.net/p/hp-soa
- Download address: https://github.com/ldcsaa/ hp-soa
Technology Architecture
Technology integration
- Microservice framework: Dubbo 3.x
- Service registration center: Nacos
- Configuration center: Nacos
- Service Governance Center: Dubbo Admin
- Traffic Control Center: Sentinel Dashboard + Nacos
- Database: MySQL, Druid, mybatis-plus (supports multiple data sources)
- Cache: Redis + Redisson (supports multiple instances)
- Message bus: RabbitMQ (supports multiple instances, supports reliable messages)
- MQTT publish and subscribe: Eclipse PAHO mqttv5
- Distributed Job: xxl-job
- Lightweight Job: Redisson + Spring Scheduled
- Distributed transactions: Seata
- Global ID: Leaf (supports Snowflake ID and Segment ID)
- Unified log: Log4j + Kafka + ELK
- Call chain tracing: Skywalking
- Monitoring alerts: Prometheus + Grafana + Alert Manager
Module description
- hp-soa-dependencies dependency management module defines dependent packages and their versions
- hp-soa-framework-core basic module defines HP-SOA basic components and tools
- hp-soa-framework-web Web application module integrates spring-boot and Dubbo to provide core microservice functions
- hp-soa-framework-leaf Leaf global ID module, based on Leaf, provides distributed global ID function
- The hp-soa-framework-util extension toolkit module provides components and tools such as file processing, email, and remote access.
- hp-soa-starter-web Web application starter, configure and start application services, all HP-SOA projects must introduce this starter
- hp-soa-starter-task Task starter, turns on the Spring Task function, and provides log correlation and call chain tracking capabilities for Spring Task
- hp-soa-starter-nacos Nacos configuration center starter, turns on the configuration center function, and the application can load the configuration from the remote configuration center
- hp-soa-starter-data-mysql MySQL starter, opens the MySQL database access function, and provides dynamic data sources, data source monitoring and global transaction management capabilities.
- hp-soa-starter-data-redis Redis starter, enables Redis access function, supports multiple Redis instances, and supports Spring Cache
- hp-soa-starter-rabbitmq Rabbitmq starter, enables Rabbitmq access function, supports multiple Rabbitmq instances, provides reliable message implementation solutions and message tracking capabilities
- hp-soa-starter-mqtt MQTT starter, turns on the MQTT publish and subscribe function, fully supports the mqttv5 protocol
- hp-soa-starter-job-exclusive lightweight job starter, enables lightweight exclusive job function, provides job execution log correlation and call chain tracking capabilities
- hp-soa-starter-job-xxljob Xxl-Job starter, turns on the Xxl-Job function, and combines with xxl-job-admin to provide distributed job capabilities
- hp-soa-starter-leaf Leaf global ID starter, turns on the Leaf global ID function, supports generating global ID through Snowflake algorithm and Segment algorithm
- hp-soa-starter-seata Seata starter, turns on Seata distributed transaction function, and combines Seata TC to provide distributed transaction capability
- hp-soa-starter-sentinel Sentinel starter, turns on Sentinel flow control function, combines Sentinel Dashboard and Nacos to provide flow control and flow control rule persistence capabilities
- hp-soa-starter-skywalking Skywalking starter, turns on the Skywalking call chain tracking function, and combines Skywalking Agent and Skywalking Server to provide call chain tracking capabilities
Application access (reference: hp-demo )
- Add HP-SOA dependency in pom.xml
<dependencyManagement> <dependencies> <!-- 添加 hp-soa 依赖管理 --> <dependency> <groupId>io.github.hpsocket</groupId> <artifactId>hp-soa-dependencies</artifactId> <version>${hp-soa.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <!-- 引用 hp-soa-starter-web --> <dependency> <groupId>io.github.hpsocket</groupId> <artifactId>hp-soa-starter-web</artifactId> </dependency> <!-- 根据项目需要,引用其它 hp-soa starter --> <dependency> <groupId>io.github.hpsocket</groupId> <artifactId>hp-soa-starter-xxx</artifactId> </dependency> </dependencies>
- Modify the application configuration (refer to the local configuration file of Demo hp-demo-bff-basic and the remote configuration file of the configuration center ). Main configuration items:
- hp.soa.web
- dubbo
- server
- spring
- management
- springdoc
- Modify global configuration (optional)
- System configuration file, used to set system properties, default configuration file:
/opt/hp-soa/config/system-config.properties
Reference: system-config.properties - Extended configuration file, used to configure public properties such as registration center address and configuration center address. Default configuration file:
/opt/hp-soa/config/extended-config.properties
Reference: extended-config.properties
- System configuration file, used to set system properties, default configuration file:
- Implement HTTP authentication interface (optional)
- If it is a Gateway/BFF application and attributes are applied
hp.soa.web.access-verification.enabled = true
, the AccessVerificationService interface needs to be implemented for HTTP request authentication.
- If it is a Gateway/BFF application and attributes are applied
- Start application
- Use io.github.hpsocket.soa.framework.web.server.main.AppStarter as the startup class to start the application.
- JVM startup parameter reference: JVM startup parameter example
Best Practices
- Application integration
- Nacos configuration center
- MySQL database
- Redis cache
- RabbitMQ message queue
- MQTT publish-subscribe
- Spring Task
- Job scheduling
- Leaf global ID generation
- Seata distributed transactions
- ELK unified log
- Sentinel flow control
- Skywalking call chain tracking
- Toolkit
- Package and publish
- Best Practices