想象一下我们有许多生产者和一个消费者的情景。消费者订阅名为“consumerGroup”的频道组。每次制作人进入系统时,他都会将频道“Producer-ID-Channel”添加到consumerGroup,订阅频道并发布消息。
消费者是否自动订阅了这个频道,因为他已经订阅了它所属的群组?即使生产者的频道在他最初订阅该群组之后被添加到该群组中呢?
答案 0 :(得分:1)
是的!所有客户端需要做的是订阅频道组,并且无论通过何种方式将频道添加/删除到频道组,客户端都将接收它们。
在JavaScript上,如果您的消息回调如下:
function cb(message, envelope, channel){
/* message will contain the message
envelope will contain the server-response, in which data like message and channel are
derived from.
element 0 will be the current message in the callback cycle
(also accessible via 'message')
element 1 will be the timetoken of the server response
element 2 will be the channel group name the message arrived on
element 3 will be the actual channel within the channel group the msg arrived on */
}
geremy