All Projects → go-chassis → sc-client

go-chassis / sc-client

Licence: Apache-2.0 license
Go client of ServiceComb Service Center

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to sc-client

Go Chassis
a microservice framework for rapid development of micro services in Go with rich eco-system
Stars: ✭ 2,428 (+4235.71%)
Mutual labels:  servicecomb
Servicecomb Pack
Apache ServiceComb Pack is an eventually data consistency solution for micro-service applications. ServiceComb Pack currently provides TCC and Saga distributed transaction co-ordination solutions by using Alpha as a transaction coordinator and Omega as an transaction agent .
Stars: ✭ 1,885 (+3266.07%)
Mutual labels:  servicecomb
Servicecomb Java Chassis
ServiceComb Java Chassis is a Software Development Kit (SDK) for rapid development of microservices in Java, providing service registration, service discovery, dynamic routing, and service management features
Stars: ✭ 1,746 (+3017.86%)
Mutual labels:  servicecomb

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 of Service Center.

Usage

registryClient, err := sc.NewClient(
	sc.Options{
		Addrs: []string{"127.0.0.1:30100"},
	})

declare and register micro service

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

	microServiceInstance := &discovery.MicroServiceInstance{
		Endpoints: []string{"rest://127.0.0.1:3000"},
		HostName:  hostname,
		Status:    sc.MSInstanceUP,
	}
	id, err := registryClient.RegisterMicroServiceInstance(microServiceInstance)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].