noop impl (#32)

* improve logger usage
* add noop client and server

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2020-09-05 02:11:29 +03:00
committed by GitHub
parent c062aab1a9
commit c576749b57
24 changed files with 418 additions and 140 deletions

View File

@@ -9,6 +9,10 @@ type HandlerOptions struct {
Metadata map[string]map[string]string
}
func NewHandlerOptions() HandlerOptions {
return HandlerOptions{}
}
type SubscriberOption func(*SubscriberOptions)
type SubscriberOptions struct {
@@ -20,6 +24,19 @@ type SubscriberOptions struct {
Context context.Context
}
func NewSubscriberOptions(opts ...SubscriberOption) SubscriberOptions {
opt := SubscriberOptions{
AutoAck: true,
Context: context.Background(),
}
for _, o := range opts {
o(&opt)
}
return opt
}
// EndpointMetadata is a Handler option that allows metadata to be added to
// individual endpoints.
func EndpointMetadata(name string, md map[string]string) HandlerOption {
@@ -44,18 +61,6 @@ func InternalSubscriber(b bool) SubscriberOption {
o.Internal = b
}
}
func NewSubscriberOptions(opts ...SubscriberOption) SubscriberOptions {
opt := SubscriberOptions{
AutoAck: true,
Context: context.Background(),
}
for _, o := range opts {
o(&opt)
}
return opt
}
// DisableAutoAck will disable auto acking of messages
// after they have been handled.