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.
Describe the Bug
RocketMQClientTemplate.receiveAsync(...)(rocketmq-v5-client-spring-boot) closes the sharedSimpleConsumerright after starting an asynchronous receive:The
SimpleConsumeris a template-level singleton whose lifecycle belongs to the Spring bean'sdestroy()(which already closes it). Closing it here (1) disrupts the in-flight async receive it just started, and (2) permanently breaks the template: every subsequentreceive/receiveAsync/ack/changeInvisibleDurationon the same template fails because the consumer is already closed. The synchronousreceive()sibling does not close the consumer.Steps to Reproduce
Call
receiveAsynconce, then any other consumer operation on the same template — it fails on the closed consumer.What Did You Expect to See?
receiveAsyncbehaves likereceive(): uses the shared consumer and leaves its lifecycle todestroy().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.