Skip to content

Commit 3d2cd25

Browse files
cserwendengzhiwen1
authored andcommitted
fix some params for consumer can not be changed
1 parent 0189e44 commit 3d2cd25

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

consumer/option.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ func defaultPushConsumerOptions() consumerOptions {
118118
ConsumerModel: Clustering,
119119
AutoCommit: true,
120120
Resolver: primitive.NewHttpResolver("DEFAULT"),
121+
ConsumeTimestamp: time.Now().Add(time.Minute * (-30)).Format("20060102150405"),
121122
}
122123
opts.ClientOptions.GroupName = "DEFAULT_CONSUMER"
123124
return opts
@@ -158,6 +159,24 @@ func WithConsumeMessageBatchMaxSize(consumeMessageBatchMaxSize int) Option {
158159
}
159160
}
160161

162+
func WithConsumeTimestamp(consumeTimestamp string) Option {
163+
return func(options *consumerOptions) {
164+
options.ConsumeTimestamp = consumeTimestamp
165+
}
166+
}
167+
168+
func WithConsumerPullTimeout(consumerPullTimeout time.Duration) Option {
169+
return func(options *consumerOptions) {
170+
options.ConsumerPullTimeout = consumerPullTimeout
171+
}
172+
}
173+
174+
func WithConsumeConcurrentlyMaxSpan(consumeConcurrentlyMaxSpan int) Option {
175+
return func(options *consumerOptions) {
176+
options.ConsumeConcurrentlyMaxSpan = consumeConcurrentlyMaxSpan
177+
}
178+
}
179+
161180
// WithChainConsumerInterceptor returns a ConsumerOption that specifies the chained interceptor for consumer.
162181
// The first interceptor will be the outer most, while the last interceptor will be the inner most wrapper
163182
// around the real call.

0 commit comments

Comments
 (0)