这个问题与为什么我需要轮询消息集线器有关,与该答案链接的文档显示Kafka将支持“长轮询”概念,但是现有的nodejs支持消息集线器没有明确的方法来实现这样的机制。为 nodejs 提供的演示应用程序仅使用 250 毫秒的计时器间隔来处理从服务器检索消息。我想用更复杂的长轮询方法替换它,使用 Kafka 支持长轮询方法:
To avoid this we have parameters in our pull request that allow the consumer request to block in a "long poll" waiting until data arrives
但是现有实现似乎不允许配置任何此类参数,也不清楚必要的参数是什么是。get函数的原型定义为:
MessageHub.ConsumerInstance.prototype.get(topicName [toValue])
Retrieves a message from the provided topic name.
topicName - (String) (required), the topic to retrieve messages from.
toValue - (Boolean) (optional), unwraps base64 encoded messages, if true. Defaults to true.
Returns a Promise object which will be fulfilled when the request to the service resolves.
所以没有配置选项。或者,您能否提供一个链接,该文档定义了在 message-hub.js 模块中实现的那些 URL 的 URL 和可用选项?