From 191e835aa9efbd04b7720bf48b6f51cd925268e4 Mon Sep 17 00:00:00 2001 From: Asim Date: Thu, 31 Dec 2015 18:14:40 +0000 Subject: [PATCH] Add extra options to be used by others that need them --- broker/options.go | 8 +++++++- registry/options.go | 3 +++ selector/options.go | 6 ++++++ transport/http_transport.go | 2 +- transport/transport.go | 12 +++++++++--- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/broker/options.go b/broker/options.go index 8c897d84..a0309aa1 100644 --- a/broker/options.go +++ b/broker/options.go @@ -6,7 +6,10 @@ type Options struct { Options map[string]string } -type PublishOptions struct{} +type PublishOptions struct { + // Other options to be used by broker implementations + Options map[string]string +} type SubscribeOptions struct { // AutoAck defaults to true. When a handler returns @@ -16,6 +19,9 @@ type SubscribeOptions struct { // will create a shared subscription where each // receives a subset of messages. Queue string + + // Other options to be used by broker implementations + Options map[string]string } type Option func(*Options) diff --git a/registry/options.go b/registry/options.go index fbd16b34..ab951103 100644 --- a/registry/options.go +++ b/registry/options.go @@ -6,6 +6,9 @@ import ( type Options struct { Timeout time.Duration + + // Other options to be used by registry implementations + Options map[string]string } func Timeout(t time.Duration) Option { diff --git a/selector/options.go b/selector/options.go index 59738edf..d7e0a417 100644 --- a/selector/options.go +++ b/selector/options.go @@ -6,10 +6,16 @@ import ( type Options struct { Registry registry.Registry + + // Other options to be used by broker implementations + Options map[string]string } type SelectOptions struct { Filters []SelectFilter + + // Other options to be used by broker implementations + Options map[string]string } // Option used to initialise the selector diff --git a/transport/http_transport.go b/transport/http_transport.go index 4d0f6344..5adeac73 100644 --- a/transport/http_transport.go +++ b/transport/http_transport.go @@ -87,7 +87,7 @@ func (h *httpTransportClient) Send(m *Message) error { func (h *httpTransportClient) Recv(m *Message) error { var r *http.Request - if !h.dialOpts.stream { + if !h.dialOpts.Stream { rc, ok := <-h.r if !ok { return io.EOF diff --git a/transport/transport.go b/transport/transport.go index 295a2a56..ab647186 100644 --- a/transport/transport.go +++ b/transport/transport.go @@ -29,10 +29,16 @@ type Transport interface { String() string } -type Options struct{} +type Options struct { + // Other options to be used by broker implementations + Options map[string]string +} type DialOptions struct { - stream bool + Stream bool + + // Other options to be used by broker implementations + Options map[string]string } type Option func(*Options) @@ -45,7 +51,7 @@ var ( func WithStream() DialOption { return func(o *DialOptions) { - o.stream = true + o.Stream = true } }