Support endpoint metadata

This commit is contained in:
Asim
2016-05-26 18:01:02 +01:00
parent 1254a87286
commit 8245390b5a
2 changed files with 18 additions and 1 deletions

View File

@@ -34,6 +34,7 @@ type Subscriber interface {
type HandlerOptions struct {
Internal bool
Metadata map[string]map[string]string
}
type SubscriberOptions struct {
@@ -50,6 +51,14 @@ func InternalHandler(b bool) HandlerOption {
}
}
// EndpointMetadata is a Handler option that allows metadata to be added to
// individual endpoints.
func EndpointMetadata(endpoint string, metadata map[string]string) HandlerOption {
return func(o *HandlerOptions) {
o.Metadata[endpoint] = metadata
}
}
// Internal Subscriber options specifies that a subscriber is not advertised
// to the discovery system.
func InternalSubscriber(b bool) SubscriberOption {