From 4739225d6f2f150e5fe3bb1350a66cb8a6260427 Mon Sep 17 00:00:00 2001 From: Aaqa Ishtyaq Date: Wed, 7 Dec 2022 10:41:12 +0530 Subject: [PATCH] add quorum queue option for the consumer Signed-off-by: Aaqa Ishtyaq --- consumer_options.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/consumer_options.go b/consumer_options.go index 42d4b96..904a561 100644 --- a/consumer_options.go +++ b/consumer_options.go @@ -282,3 +282,14 @@ func WithConsumerOptionsQOSPrefetch(prefetchCount int) func(*ConsumerOptions) { func WithConsumerOptionsQOSGlobal(options *ConsumerOptions) { options.QOSGlobal = true } + +// WithConsumerOptionsQueueQuorum sets the queue a quorum type, which means +// multiple nodes in the cluster will have the messages distributed amongst them +// for higher reliability +func WithConsumerOptionsQueueQuorum(options *ConsumerOptions) { + if options.QueueOptions.Args == nil { + options.QueueOptions.Args = Table{} + } + + options.QueueOptions.Args["x-queue-type"] = "quorum" +}