[英]how to pause consumers from consuming messages in spring cloud stream
I ran into situation where I want to pause consumers to stop consuming messages through spring boot application and messages should not be lost from queue, I am using amqp and spring cloud stream. 我遇到了一些情况,我希望暂停消费者停止通过Spring启动应用程序消费消息,消息不应该从队列中丢失,我正在使用amqp和spring cloud stream。
https://github.com/spring-cloud/spring-cloud-stream/blob/master/docs/src/main/asciidoc/spring-cloud-stream.adoc#binding_visualization_control this states only kafka has this option. https://github.com/spring-cloud/spring-cloud-stream/blob/master/docs/src/main/asciidoc/spring-cloud-stream.adoc#binding_visualization_control这表明只有kafka有此选项。
Can I do something to fix this for rabbit-mq binder? 我可以为Rabbit-mq活页夹做些什么来解决这个问题吗?
Pause is required for Kafka because if you stop()
the container, the broker will rebalance and give the partitions to another instance. Kafka需要暂停,因为如果你stop()
容器,代理将重新平衡并将分区提供给另一个实例。 With RabbitMQ, the queue remains when the container is stop()
ped so the issue doesn't arise there (as long as you specify a group
). 使用RabbitMQ,当容器stop()
时,队列仍然存在,因此不会出现问题(只要您指定一个group
)。
You can't stop()
the container for an anonymous consumer (no group
) because such consumers use an auto-delete queue. 您无法stop()
匿名使用者(无group
stop()
的容器,因为此类使用者使用自动删除队列。 There is no way to pause such consumers (the AMQP protocol has no such mechanism). 没有办法暂停这样的消费者(AMQP协议没有这样的机制)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.