allow setting registry router in client

This commit is contained in:
Asim Aslam 2020-08-17 22:53:20 +01:00
parent 50ec6c748f
commit 4fd4a116f2

View File

@ -7,6 +7,7 @@ import (
"github.com/micro/go-micro/v3/broker"
"github.com/micro/go-micro/v3/broker/http"
"github.com/micro/go-micro/v3/codec"
"github.com/micro/go-micro/v3/registry"
"github.com/micro/go-micro/v3/router"
regRouter "github.com/micro/go-micro/v3/router/registry"
"github.com/micro/go-micro/v3/selector"
@ -184,6 +185,13 @@ func Transport(t transport.Transport) Option {
}
}
// Registry sets the routers registry
func Registry(r registry.Registry) Option {
return func(o *Options) {
o.Router.Init(router.Registry(r))
}
}
// Router is used to lookup routes for a service
func Router(r router.Router) Option {
return func(o *Options) {