This is an automated email from the ASF dual-hosted git repository.
wenfeng pushed a commit to branch native
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-go.git
The following commit(s) were added to refs/heads/native by this push:
new 0f2efa6 feat: more consumer option config (#363)
0f2efa6 is described below
commit 0f2efa6fbf17466fd677e1647e8c317a788d602d
Author: xujianhai666 <[email protected]>
AuthorDate: Fri Jan 3 16:27:04 2020 +0800
feat: more consumer option config (#363)
Closes #362
---
consumer/option.go | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/consumer/option.go b/consumer/option.go
index 6e7f4d2..5b585a3 100644
--- a/consumer/option.go
+++ b/consumer/option.go
@@ -233,3 +233,33 @@ func WithStrategy(strategy AllocateStrategy) Option {
opts.Strategy = strategy
}
}
+
+func WithPullBatchSize(batchSize int32) Option {
+ return func(options *consumerOptions) {
+ options.PullBatchSize = batchSize
+ }
+}
+
+func WithRebalanceLockInterval(interval time.Duration) Option {
+ return func(options *consumerOptions) {
+ options.RebalanceLockInterval = interval
+ }
+}
+
+func WithAutoCommit(auto bool) Option {
+ return func(options *consumerOptions) {
+ options.AutoCommit = auto
+ }
+}
+
+func WithSuspendCurrentQueueTimeMillis(suspendT time.Duration) Option {
+ return func(options *consumerOptions) {
+ options.SuspendCurrentQueueTimeMillis = suspendT
+ }
+}
+
+func WithPullInterval(interval time.Duration) Option {
+ return func(options *consumerOptions) {
+ options.PullInterval = interval
+ }
+}