Registry - Polaris Integration
Description
This example demonstrates how to integrate Polaris service registry with GoFrame applications. It shows how to:
- Register services with
Polaris - Discover services using
Polaris - Implement service health checks
- Build distributed systems
Structure
.
├── client/ # Client example
│ └── client.go # Client implementation with Polaris discovery
├── server/ # Server example
│ └── server.go # Server implementation with Polaris registration
├── go.mod # Go module file
└── go.sum # Go module checksumsFeatures
The example showcases the following features:
Service Registration
- Automatic service registration
- Health check configuration
- Metadata management
- Service routing
- Rate limiting
Service Discovery
- Dynamic service discovery
- Load balancing
- Failover support
- Circuit breaking
- Fault tolerance
Protocol Support
HTTPservices- Custom protocols
- Protocol extension
Requirements
- Go
1.22or higher - Git
- GoFrame
- GoFrame Polaris Registry
- Polaris
Prerequisites
- Running
Polarisserver:# Using docker docker run -d \ --name polaris \ -p 8090:8090 \ -p 8091:8091 \ -p 8093:8093 \ -p 8761:8761 \ polarismesh/polaris-server
Usage
Start the server:
cd server go run server.goRun the client:
cd client go run client.go
Implementation Details
The example demonstrates:
Polarisclient configuration- Service registration process
- Service discovery mechanism
- Health check implementation
- Load balancing strategies
- Circuit breaker configuration
- Rate limiting setup