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

@@ -20,6 +20,7 @@ type Handler interface {
Name() string
Handler() interface{}
Endpoints() []*registry.Endpoint
Options() HandlerOptions
}
// Subscriber interface represents a subscription to a given topic using
@@ -28,4 +29,30 @@ type Subscriber interface {
Topic() string
Subscriber() interface{}
Endpoints() []*registry.Endpoint
Options() SubscriberOptions
}
type HandlerOptions struct {
Internal bool
}
type SubscriberOptions struct {
Internal bool
}
// Internal Handler options specifies that a handler is not advertised
// to the discovery system. In the future this may also limit request
// to the internal network or authorised user.
func InternalHandler(b bool) HandlerOption {
return func(o *HandlerOptions) {
o.Internal = b
}
}
// Internal Subscriber options specifies that a subscriber is not advertised
// to the discovery system.
func InternalSubscriber(b bool) SubscriberOption {
return func(o *SubscriberOptions) {
o.Internal = b
}
}