1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-24 10:07:04 +02:00

Fix service registration with registry service

This commit is contained in:
Asim Aslam 2020-01-18 19:53:51 +00:00
parent 31e195bac7
commit 0a37767127
6 changed files with 13 additions and 13 deletions

View File

@ -110,6 +110,9 @@ var (
DefaultPoolSize = 100
// DefaultPoolTTL sets the connection pool ttl
DefaultPoolTTL = time.Minute
// NewClient returns a new client
NewClient func(...Option) Client = newRpcClient
)
// Makes a synchronous call to a service using the default client
@ -128,11 +131,6 @@ func NewMessage(topic string, payload interface{}, opts ...MessageOption) Messag
return DefaultClient.NewMessage(topic, payload, opts...)
}
// Creates a new client with the options passed in
func NewClient(opt ...Option) Client {
return newRpcClient(opt...)
}
// Creates a new request using the default client. Content Type will
// be set to the default within options and use the appropriate codec
func NewRequest(service, endpoint string, request interface{}, reqOpts ...RequestOption) Request {

View File

@ -19,6 +19,10 @@ func init() {
// embedded nats server
nats.LocalServer(),
)
// new client initialisation
client.NewClient = gcli.NewClient
// new server initialisation
server.NewServer = gsrv.NewServer
// default client
client.DefaultClient = gcli.NewClient()
// default server

View File

@ -12,7 +12,7 @@ import (
var (
// The default service name
DefaultService = "go.micro.service"
DefaultService = "go.micro.registry"
)
type serviceRegistry struct {
@ -128,7 +128,7 @@ func (s *serviceRegistry) Watch(opts ...registry.WatchOption) (registry.Watcher,
}
func (s *serviceRegistry) String() string {
return s.name
return "service"
}
// NewRegistry returns a new registry service client

View File

@ -82,6 +82,7 @@ func ToProto(s *registry.Service) *pb.Service {
Metadata: s.Metadata,
Endpoints: endpoints,
Nodes: nodes,
Options: new(pb.Options),
}
}

View File

@ -136,6 +136,9 @@ var (
DefaultRegisterCheck = func(context.Context) error { return nil }
DefaultRegisterInterval = time.Second * 30
DefaultRegisterTTL = time.Minute
// NewServer creates a new server
NewServer func(...Option) Server = newRpcServer
)
// DefaultOptions returns config options for the default service
@ -151,11 +154,6 @@ func Init(opt ...Option) {
DefaultServer.Init(opt...)
}
// NewServer returns a new server with options passed in
func NewServer(opt ...Option) Server {
return newRpcServer(opt...)
}
// NewRouter returns a new router
func NewRouter() *router {
return newRpcRouter()

View File

@ -5,7 +5,6 @@ var templates = map[string]string{
"service": serviceTmpl,
}
// stripped image pull policy always
// imagePullPolicy: Always
var deploymentTmpl = `