micro/server/handler.go

44 lines
1.1 KiB
Go
Raw Permalink Normal View History

package server
type HandlerOptions struct {
Internal bool
2016-05-26 18:01:02 +01:00
Metadata map[string]map[string]string
}
type SubscriberOptions struct {
2016-01-22 21:48:43 +00:00
Queue string
Internal bool
}
2016-05-26 20:43:05 +01:00
// EndpointMetadata is a Handler option that allows metadata to be added to
// individual endpoints.
func EndpointMetadata(name string, md map[string]string) HandlerOption {
return func(o *HandlerOptions) {
o.Metadata[name] = md
}
}
// 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
}
}
2016-01-22 21:48:43 +00:00
// Shared queue name distributed messages across subscribers
func SubscriberQueue(n string) SubscriberOption {
return func(o *SubscriberOptions) {
o.Queue = n
}
}