move broker codec

This commit is contained in:
Asim Aslam
2016-12-06 18:59:41 +00:00
parent 49e5636bcd
commit 25a6849609
5 changed files with 24 additions and 22 deletions

View File

@@ -3,6 +3,7 @@ package broker
import (
"crypto/tls"
"github.com/micro/go-micro/broker/codec"
"github.com/micro/go-micro/registry"
"golang.org/x/net/context"
)
@@ -10,9 +11,8 @@ import (
type Options struct {
Addrs []string
Secure bool
Codec Codec
Codec codec.Codec
TLSConfig *tls.Config
// Other options for implementations of the interface
// can be stored in a context
Context context.Context
@@ -69,6 +69,14 @@ func Addrs(addrs ...string) Option {
}
}
// Codec sets the codec used for encoding/decoding used where
// a broker does not support headers
func Codec(c codec.Codec) Option {
return func(o *Options) {
o.Codec = c
}
}
// DisableAutoAck will disable auto acking of messages
// after they have been handled.
func DisableAutoAck() SubscribeOption {
@@ -97,14 +105,6 @@ func Secure(b bool) Option {
}
}
// Codec sets the codec used for encoding/decoding used where
// a broker does not support headers
func SetCodec(c Codec) Option {
return func(o *Options) {
o.Codec = c
}
}
// Specify TLS Config
func TLSConfig(t *tls.Config) Option {
return func(o *Options) {