gpt4 book ai didi

apache-kafka - Apache Pulsar 与 Kafka - 消费者是否从主题中提取(轮询)消息?

转载 作者:行者123 更新时间:2023-12-03 23:48:16 24 4
gpt4 key购买 nike

我知道在 Kafka 中,消费者从代理主题(pull)中提取消息?

考虑到 receive ,我觉得 Pulsar 的工作方式是一样的。方法块。但我找不到确认。有人可以指出我的引用资料或纠正我吗?

谢谢

最佳答案

Pulsar's Documentation清楚地解释了消息消费的工作原理:

The Pulsar Consumer origin reads messages from one or more topics in an Apache Pulsar cluster.

The Pulsar Consumer origin subscribes to Pulsar topics, processes incoming messages, and then sends acknowledgements back to Pulsar as the messages are read.



可以从代理接收消息 synchronously (sync) or asynchronously (async) .
receive方法接收消息 同步 .消费者进程将被阻塞,直到消息可用。例如,
Message msg = consumer.receive();

异步 接收将立即返回类型为 CompletableFuture 的值一旦有新消息可用,即完成。例如,
CompletableFuture<Message> asyncMessage = consumer.receiveAsync();

关于apache-kafka - Apache Pulsar 与 Kafka - 消费者是否从主题中提取(轮询)消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61125349/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com