client: WithBodyOnly publish option
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
		| @@ -118,6 +118,8 @@ func NewPublishOptions(opts ...PublishOption) PublishOptions { | |||||||
|  |  | ||||||
| // PublishOptions holds publish options | // PublishOptions holds publish options | ||||||
| type PublishOptions struct { | type PublishOptions struct { | ||||||
|  | 	// BodyOnly will publish only message body | ||||||
|  | 	BodyOnly bool | ||||||
| 	// Context used for external options | 	// Context used for external options | ||||||
| 	Context context.Context | 	Context context.Context | ||||||
| 	// Exchange topic exchange name | 	// 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 | // PublishContext sets the context in publish options | ||||||
| func PublishContext(ctx context.Context) PublishOption { | func PublishContext(ctx context.Context) PublishOption { | ||||||
| 	return func(o *PublishOptions) { | 	return func(o *PublishOptions) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user