Add pluggable codec support
This commit is contained in:
@@ -7,9 +7,11 @@ import (
|
||||
)
|
||||
|
||||
type options struct {
|
||||
broker broker.Broker
|
||||
registry registry.Registry
|
||||
transport transport.Transport
|
||||
contentType string
|
||||
codecs map[string]CodecFunc
|
||||
broker broker.Broker
|
||||
registry registry.Registry
|
||||
transport transport.Transport
|
||||
}
|
||||
|
||||
func Broker(b broker.Broker) Option {
|
||||
@@ -18,6 +20,18 @@ func Broker(b broker.Broker) Option {
|
||||
}
|
||||
}
|
||||
|
||||
func Codec(contentType string, cf CodecFunc) Option {
|
||||
return func(o *options) {
|
||||
o.codecs[contentType] = cf
|
||||
}
|
||||
}
|
||||
|
||||
func ContentType(ct string) Option {
|
||||
return func(o *options) {
|
||||
o.contentType = ct
|
||||
}
|
||||
}
|
||||
|
||||
func Registry(r registry.Registry) Option {
|
||||
return func(o *options) {
|
||||
o.registry = r
|
||||
|
Reference in New Issue
Block a user