有没有办法更新ConcurrentMessageListenerContainer中的并发数?

Is there a way to update the number of concurrency in ConcurrentMessageListenerContainer?

我开发了一个应用程序,它使用 spring-kafka 包并更改它在 运行 时间内处理的数据量。
我想让系统能够在 运行 时间内更改 concurrency 的数量取决于系统感受到的压力(我将定义的东西)。
现在我的解决方案是 doStopdoStart 明确 ConcurrentMessageListenerContainer 但我寻找一种干净的方式,不会损坏流并且不会触及 ConcurrentMessageListenerContainer 的内部方法明确地

您不需要与这些内部方法进行交互;使用 stop()start(),它们是 public。

您不能动态更改并发,只能通过停止和启动容器,在停止时更改并发。