Fix the broker and add secure option

This commit is contained in:
Asim
2016-01-16 22:13:02 +00:00
parent 60ee085cbc
commit 36e709c9f7
2 changed files with 63 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ import (
)
type Options struct {
Secure bool
// Other options for implementations of the interface
// can be stored in a context
@@ -37,6 +38,18 @@ type PublishOption func(*PublishOptions)
type SubscribeOption func(*SubscribeOptions)
func newSubscribeOptions(opts ...SubscribeOption) SubscribeOptions {
opt := SubscribeOptions{
AutoAck: true,
}
for _, o := range opts {
o(&opt)
}
return opt
}
// DisableAutoAck will disable auto acking of messages
// after they have been handled.
func DisableAutoAck() SubscribeOption {
@@ -52,14 +65,9 @@ func QueueName(name string) SubscribeOption {
}
}
func newSubscribeOptions(opts ...SubscribeOption) SubscribeOptions {
opt := SubscribeOptions{
AutoAck: true,
// Secure communication with the broker
func Secure(b bool) Option {
return func(o *Options) {
o.Secure = b
}
for _, o := range opts {
o(&opt)
}
return opt
}