You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "xintai (via GitHub)" <gi...@apache.org> on 2024/07/30 10:03:14 UTC
[I] [Bug] 消息重复消费 [rocketmq-clients]
xintai opened a new issue, #808:
URL: https://github.com/apache/rocketmq-clients/issues/808
### Before Creating the Bug Report
- [X] I found a bug, not just asking a question, which should be created in [GitHub Discussions](https://github.com/apache/rocketmq-clients/discussions).
- [X] I have searched the [GitHub Issues](https://github.com/apache/rocketmq-clients/issues) and [GitHub Discussions](https://github.com/apache/rocketmq-clients/discussions) of this repository and believe that this is not a duplicate.
- [X] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.
### Programming Language of the Client
Go
### Runtime Platform Environment
Linux broker-a-0 5.15.0-25-generic #25-Ubuntu SMP Wed Mar 30 15:54:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
### RocketMQ Version of the Client/Server
server 5.2.0
github.com/apache/rocketmq-clients/golang v0.0.0-20230321063829-41bfbcf6130d
### Run or Compiler Version
_No response_
### Describe the Bug
同一个消息id发送一次,收到三次。
一个消费组,三个消费者。
kubernetes.pod_name
5778459bf5-p56gh
log
2024-07-30T07:47:51.216Z DEBUG golang@v0.0.0-20230321063829-41bfbcf6130d/rpc_client.go:146 ackMessage request: group:{name:"cg_notify_user"} topic:{name:"topic_notify_user"} entries:{message_id:"01B2F5ABE17438000106BA349200000000" receipt_handle:"194 1722325671049 600000 0 0 broker-b 1 194 5228468"}, response: status:{code:OK message:"OK"} entries:{message_id:"01B2F5ABE17438000106BA349200000000" receipt_handle:"194 1722325671049 600000 0 0 broker-b 1 194 5228468" status:{code:OK message:"OK"}}, err: <nil>
kubernetes.pod_name
5778459bf5-cqps7
log
2024-07-30T07:47:31.039Z DEBUG golang@v0.0.0-20230321063829-41bfbcf6130d/rpc_client.go:146 ackMessage request: group:{name:"cg_notify_user"} topic:{name:"topic_notify_user"} entries:{message_id:"01B2F5ABE17438000106BA349200000000" receipt_handle:"194 1722325650795 600000 6 0 broker-b 1 194 5228468"}, response: status:{code:OK message:"OK"} entries:{message_id:"01B2F5ABE17438000106BA349200000000" receipt_handle:"194 1722325650795 600000 6 0 broker-b 1 194 5228468" status:{code:OK message:"OK"}}, err: <nil>
kubernetes.pod_name
5778459bf5-p56gh
log
2024-07-30T07:47:31.098Z DEBUG golang@v0.0.0-20230321063829-41bfbcf6130d/rpc_client.go:146 ackMessage request: group:{name:"cg_notify_user"} topic:{name:"topic_notify_user"} entries:{message_id:"01B2F5ABE17438000106BA349200000000" receipt_handle:"194 1722325650851 600000 5 0 broker-b 1 194 5228468"}, response: status:{code:OK message:"OK"} entries:{message_id:"01B2F5ABE17438000106BA349200000000" receipt_handle:"194 1722325650851 600000 5 0 broker-b 1 194 5228468" status:{code:OK message:"OK"}}, err: <nil>
### Steps to Reproduce
发消息
p, err := rocketmq.NewProducer(config.AccountCfg.MQConfig.Endpoint, InstanceOperationNamespace,
"", NotifyUserTopic, config.AccountCfg.MQConfig.AccessKey, config.AccountCfg.MQConfig.AccessSecret)
msg := &NotifyUserEvent{
EventID: eventID,
Uid: uid,
Uuid: uuid,
Phone: phone,
}
body, err := json.Marshal(msg)
if err != nil {
klog.Errorf("Failed to marshal message: %v", err)
return err
}
msg := &golang.Message{
Topic: topic,
Body: body,
}
// set keys and tag
if len(keys) > 0 {
msg.SetKeys(keys...)
}
if tag != "" {
msg.SetTag(tag)
}
// send message in sync
resp, err := p.Producer.Send(context.TODO(), msg)
收消息
mvs, err := c.Consumer.Receive(context.TODO(), config.GlobalCfg.ConsumerMaxMessageNum,
time.Duration(config.GlobalCfg.ConsumerAwaitDuration)*time.Second)
if err != nil {
klog.Errorf("receive message from rocketmq failed: %v", err)
return nil, err
}
for _, mv := range mvs {
body := mv.GetBody()
klog.CtxInfof(p.Ctx, "MQ receive. topic:%v, msgID:%v, msg:%v", mv.GetTopic(), mv.GetMessageId(), string(body))
err = p.Do(p, body)
if err != nil {
klog.Errorf("Failed to process message %+v: %v", mv, err)
}
err = c.Ack(p.Ctx, mv)
if err != nil {
klog.Errorf("Failed to ack message %+v: %v", mv, err)
}
}
### What Did You Expect to See?
期望消费一次
### What Did You See Instead?
重复消费
### Additional Context
_No response_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] 消息重复消费 [rocketmq-clients]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #808:
URL: https://github.com/apache/rocketmq-clients/issues/808#issuecomment-2319531806
This issue is stale because it has been open for 30 days with no activity. It will be closed in 3 days if no further activity occurs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] 消息重复消费 [rocketmq-clients]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #808:
URL: https://github.com/apache/rocketmq-clients/issues/808#issuecomment-2323563441
This issue was closed because it has been inactive for 3 days since being marked as stale.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] 消息重复消费 [rocketmq-clients]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #808: [Bug] 消息重复消费
URL: https://github.com/apache/rocketmq-clients/issues/808
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org