Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/go-chassis/sc-client
Go client of ServiceComb Service Center
https://github.com/go-chassis/sc-client
microservice servicecomb
Last synced: 1 day ago
JSON representation
Go client of ServiceComb Service Center
- Host: GitHub
- URL: https://github.com/go-chassis/sc-client
- Owner: go-chassis
- License: apache-2.0
- Created: 2018-01-15T12:54:39.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2025-01-23T01:33:34.000Z (13 days ago)
- Last Synced: 2025-01-27T22:30:55.561Z (9 days ago)
- Topics: microservice, servicecomb
- Language: Go
- Homepage:
- Size: 195 KB
- Stars: 58
- Watchers: 8
- Forks: 25
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Service Center client for go
This is a service center client which helps the microservice to interact with Service Center
for service-registration, discovery, instance registration etc.This client implements [API](https://github.com/apache/servicecomb-service-center/blob/master/docs/openapi/v4.yaml) of Service Center.
# Usage
```go
registryClient, err := sc.NewClient(
sc.Options{
Addrs: []string{"127.0.0.1:30100"},
})
```
declare and register micro service
```go
var ms = new(discovery.MicroService)
var m = make(map[string]string)m["abc"] = "abc"
m["def"] = "def"ms.AppId = MSList[0].AppId
ms.ServiceName = MSList[0].ServiceName
ms.Version = MSList[0].Version
ms.Environment = MSList[0].Environment
ms.Properties = m
sid, err := registryClient.RegisterService(ms)
```
declare and register instance
```go
microServiceInstance := &discovery.MicroServiceInstance{
Endpoints: []string{"rest://127.0.0.1:3000"},
HostName: hostname,
Status: sc.MSInstanceUP,
}
id, err := registryClient.RegisterMicroServiceInstance(microServiceInstance)
```