apache / apache/rocketmq-client-go

issue: the `ctx` not work for consumer.PullFrom method

Open
#1,131 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.4k
Forks
445
PR merge metrics
No merged PRs in 30d

Description

The context not work in `consumer.PullFrom` method:
```go
c, err := consumer2.NewPullConsumer(
consumer2.WithNameServer([]string{cfg.NameSvr}),
consumer2.WithGroupName(consumerGroupName),
consumer2.WithConsumeFromWhere(consumer2.ConsumeFromLastOffset),
consumer2.WithConsumerOrder(true),
consumer2.WithRetry(1),
)
ctx, _ = context.WithTimeout(context.Background(), time.Second)

result, err := c.PullFrom(ctx, mq, offset, maxPullCount)
```
even if the `ctx` is timeout, or was canceled(if message queue have no new message) manually, it will still block for 30 seconds.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.