From 919520219c044a645af3c8b8e7e90a71394fa1fc Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Fri, 11 Jun 2021 14:14:24 +0300 Subject: [PATCH] client: WithBodyOnly publish option Signed-off-by: Vasiliy Tolstov --- client/options.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/options.go b/client/options.go index 27c0295e..555eb843 100644 --- a/client/options.go +++ b/client/options.go @@ -118,6 +118,8 @@ func NewPublishOptions(opts ...PublishOption) PublishOptions { // PublishOptions holds publish options type PublishOptions struct { + // BodyOnly will publish only message body + BodyOnly bool // Context used for external options Context context.Context // Exchange topic exchange name @@ -377,6 +379,13 @@ func WithExchange(e string) PublishOption { } } +// WithBodyOnly publish only message body +func WithBodyOnly(b bool) PublishOption { + return func(o *PublishOptions) { + o.BodyOnly = b + } +} + // PublishContext sets the context in publish options func PublishContext(ctx context.Context) PublishOption { return func(o *PublishOptions) {