-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
decouple sc client from go chassis (#36)
- Loading branch information
1 parent
f54bd13
commit e6740a2
Showing
31 changed files
with
539 additions
and
7,902 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: golangci-lint | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
branches: | ||
- master | ||
pull_request: | ||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
version: v1.29 | ||
args: --skip-dirs=examples --out-format=colored-line-number --skip-files=.*_test.go$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Merge check | ||
on: [push, pull_request] | ||
jobs: | ||
build: | ||
name: Merge check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.13 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
id: go | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v1 | ||
- name: Build | ||
run: go build -v . | ||
- name: UT | ||
run: | | ||
bash scripts/ci/start_latest_sc.sh | ||
go get github.com/stretchr/testify | ||
bash scripts/ci/unit_test.sh |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,39 @@ | ||
### Service-Center Client for Go-Chassis | ||
[![Build Status](https://travis-ci.org/go-chassis/go-sc-client.svg?branch=master)](https://travis-ci.org/go-chassis/go-sc-client) | ||
This is a service-center client which helps the microservice to interact with Service-Center | ||
for service-registration, discovery, instance registration and dependency management. | ||
# 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 all the [api's](https://rawcdn.githack.com/go-chassis/service-center/master/docs/api-docs.html) of Service-Center. | ||
This client implements all the [api's](https://rawcdn.githack.com/go-chassis/service-center/master/docs/api-docs.html) of Service Center. | ||
|
||
|
||
# Usage | ||
|
||
**NOTICE**: this client is migrate to github.com/go-chassis/go-chassis/pkg/scclient | ||
```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) | ||
``` |
Oops, something went wrong.