Update options to be public. This means people can implement the interfaces and actually use the options
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
@@ -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 {
|
||||
|
@@ -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{}
|
||||
|
||||
|
Reference in New Issue
Block a user