1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-12 22:07:47 +02:00
This commit is contained in:
Asim
2016-01-26 23:32:27 +00:00
parent ce0c5908a6
commit 5ec9d561a6
8 changed files with 142 additions and 25 deletions

View File

@ -155,7 +155,15 @@ func (s *rpcServer) Subscribe(sb Subscriber) error {
return nil
}
func (s *rpcServer) Register() error {
func (s *rpcServer) Register(opts ...RegisterOption) error {
var options RegisterOptions
for _, o := range opts {
o(&options)
}
// create registry options
rOpts := []registry.RegisterOption{registry.WithTTL(options.TTL)}
// parse address for host, port
config := s.Options()
var advt, host string
@ -220,7 +228,7 @@ func (s *rpcServer) Register() error {
}
log.Infof("Registering node: %s", node.Id)
if err := config.Registry.Register(service); err != nil {
if err := config.Registry.Register(service, rOpts...); err != nil {
return err
}