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 server
import (
"time"
"github.com/micro/go-micro/broker"
"github.com/micro/go-micro/codec"
"github.com/micro/go-micro/registry"
@@ -32,6 +34,10 @@ type Options struct {
Context context.Context
}
type RegisterOptions struct {
TTL time.Duration
}
func newOptions(opt ...Option) Options {
opts := Options{
Codecs: make(map[string]codec.NewCodec),
@@ -167,3 +173,10 @@ func WrapSubscriber(w SubscriberWrapper) Option {
o.SubWrappers = append(o.SubWrappers, w)
}
}
// Register the service with a TTL
func RegisterTTL(t time.Duration) RegisterOption {
return func(o *RegisterOptions) {
o.TTL = t
}
}