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

@@ -1,6 +1,8 @@
package micro
import (
"time"
"github.com/micro/cli"
"github.com/micro/go-micro/broker"
"github.com/micro/go-micro/client"
@@ -20,6 +22,10 @@ type Options struct {
Registry registry.Registry
Transport transport.Transport
// Registration options
RegisterTTL time.Duration
RegisterInterval time.Duration
// Before and After funcs
BeforeStart []func() error
AfterStop []func() error
@@ -117,6 +123,18 @@ func Action(a func(*cli.Context)) Option {
}
}
func RegisterTTL(t time.Duration) Option {
return func(o *Options) {
o.RegisterTTL = t
}
}
func RegisterInterval(t time.Duration) Option {
return func(o *Options) {
o.RegisterInterval = t
}
}
// Before and Afters
func BeforeStart(fn func() error) Option {