如何以编程方式启动和停止 apache pulsar 消费者?

How to programmatically start and stop apache pulsar consumer?

有什么方法可以编程控制 start/stop apache 消费者?

有暂停和恢复,但看起来没有按预期工作

从代理接收的消息在消费者中缓冲 receiverQueue。消费者的 pause 方法将使其停止向代理请求更多消息。所以你得到的消息很可能就是缓冲到receiverQueue中的消息。从您的应用程序角度来看,一旦接收方队列耗尽,您将停止接收消息。