server: add SubscriberBodyOnly option

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-02-20 18:12:05 +03:00
parent f7b5211af3
commit 8d7e442b3a

View File

@ -332,6 +332,7 @@ type SubscriberOptions struct {
AutoAck bool AutoAck bool
Queue string Queue string
Internal bool Internal bool
BodyOnly bool
Context context.Context Context context.Context
} }
@ -389,6 +390,20 @@ func SubscriberQueue(n string) SubscriberOption {
} }
} }
// SubscriberGroup sets the shared group name distributed messages across subscribers
func SubscriberGroup(n string) SubscriberOption {
return func(o *SubscriberOptions) {
o.Queue = n
}
}
// SubscriberBodyOnly says broker that message contains raw data with absence of micro broker.Message format
func SubscriberBodyOnly(b bool) SubscriberOption {
return func(o *SubscriberOptions) {
o.BodyOnly = b
}
}
// SubscriberContext set context options to allow broker SubscriberOption passed // SubscriberContext set context options to allow broker SubscriberOption passed
func SubscriberContext(ctx context.Context) SubscriberOption { func SubscriberContext(ctx context.Context) SubscriberOption {
return func(o *SubscriberOptions) { return func(o *SubscriberOptions) {