diff --git a/broker/options.go b/broker/options.go index 974b9d1e..9542c59f 100644 --- a/broker/options.go +++ b/broker/options.go @@ -45,6 +45,18 @@ type PublishOptions struct { Context context.Context } +func NewPublishOptions(opts ...PublishOption) PublishOptions { + opt := PublishOptions{ + Context: context.Background(), + } + + for _, o := range opts { + o(&opt) + } + + return opt +} + type SubscribeOptions struct { // AutoAck ack messages if handler returns nil err AutoAck bool