Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug] RocketMQClientTemplate.receiveAsync closes the shared SimpleConsumer, breaking all subsequent operations

未关闭 适合新手
#780 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@wang-jiahua 已经在做这个了。

开始于 2026年9月3日。

  • #781 来自 @wang-jiahua —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java

调研方向

从 rocketmq-v5-client-spring-boot 中的 RocketMQClientTemplate.receiveAsync(...) 开始,并将其与 receive() 和 destroy() 进行比较。使用一个记录操作的 fake consumer 运行所描述的回归测试;完成标准是共享 consumer 在 receiveAsync 之后仍可使用,并且其关闭由 destroy() 处理。

由索引模型根据 Issue 内容生成。

描述

Describe the Bug

RocketMQClientTemplate.receiveAsync(...) (rocketmq-v5-client-spring-boot) closes the shared SimpleConsumer right after starting an asynchronous receive:

SimpleConsumer simpleConsumer = this.getSimpleConsumer();
CompletableFuture<List<MessageView>> future = simpleConsumer.receiveAsync(maxMessageNum, invisibleDuration);
simpleConsumer.close();   // closes the shared singleton
return future;

The SimpleConsumer is a template-level singleton whose lifecycle belongs to the Spring bean's destroy() (which already closes it). Closing it here (1) disrupts the in-flight async receive it just started, and (2) permanently breaks the template: every subsequent receive/receiveAsync/ack/changeInvisibleDuration on the same template fails because the consumer is already closed. The synchronous receive() sibling does not close the consumer.

Steps to Reproduce

Call receiveAsync once, then any other consumer operation on the same template — it fails on the closed consumer.

What Did You Expect to See?

receiveAsync behaves like receive(): uses the shared consumer and leaves its lifecycle to destroy().

What Did You See Instead?

The shared consumer is closed after the first receiveAsync, breaking the async path and everything after it.

Additional Context

Fix incoming: remove the simpleConsumer.close() line; destroy() keeps its close. Includes a regression test with a recording fake consumer proving close is no longer invoked and the consumer stays usable.

主要语言
Java
星标
2.3k
派生
941
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/rocketmq-spring 的其他 Issue

查看 apache/rocketmq-spring 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。