Add implementation for internal handlers and subscribers. They are not advertised to discovery

This commit is contained in:
Asim
2016-01-08 14:02:32 +00:00
parent 7401c44973
commit f812613973
6 changed files with 74 additions and 15 deletions

View File

@@ -29,9 +29,15 @@ type subscriber struct {
subscriber interface{}
handlers []*handler
endpoints []*registry.Endpoint
opts SubscriberOptions
}
func newSubscriber(topic string, sub interface{}) Subscriber {
func newSubscriber(topic string, sub interface{}, opts ...SubscriberOption) Subscriber {
var options SubscriberOptions
for _, o := range opts {
o(&options)
}
var endpoints []*registry.Endpoint
var handlers []*handler
@@ -96,6 +102,7 @@ func newSubscriber(topic string, sub interface{}) Subscriber {
subscriber: sub,
handlers: handlers,
endpoints: endpoints,
opts: options,
}
}
@@ -241,3 +248,7 @@ func (s *subscriber) Subscriber() interface{} {
func (s *subscriber) Endpoints() []*registry.Endpoint {
return s.endpoints
}
func (s *subscriber) Options() SubscriberOptions {
return s.opts
}