Update options to be public. This means people can implement the interfaces and actually use the options

This commit is contained in:
Asim
2015-12-31 18:11:46 +00:00
parent c2154fd5cc
commit 64b45f7846
17 changed files with 203 additions and 200 deletions

View File

@@ -1,6 +1,7 @@
package broker
type Broker interface {
Options() Options
Address() string
Connect() error
Disconnect() error
@@ -28,7 +29,7 @@ type Publication interface {
}
type Subscriber interface {
Config() SubscribeOptions
Options() SubscribeOptions
Topic() string
Unsubscribe() error
}

View File

@@ -28,6 +28,7 @@ type httpBroker struct {
id string
address string
unsubscribe chan *httpSubscriber
opts Options
sync.RWMutex
subscribers map[string][]*httpSubscriber
@@ -85,7 +86,7 @@ func (h *httpPublication) Topic() string {
return h.t
}
func (h *httpSubscriber) Config() SubscribeOptions {
func (h *httpSubscriber) Options() SubscribeOptions {
return h.opts
}
@@ -213,6 +214,10 @@ func (h *httpBroker) Init(opts ...Option) error {
return nil
}
func (h *httpBroker) Options() Options {
return h.opts
}
func (h *httpBroker) Publish(topic string, msg *Message, opts ...PublishOption) error {
s, err := registry.GetService("topic:" + topic)
if err != nil {

View File

@@ -1,6 +1,10 @@
package broker
type Options struct{}
type Options struct {
// Other options to be used by broker implementations
Options map[string]string
}
type PublishOptions struct{}