wso2wso2-message-broker

Subscribing to clustered WSO2 MB


According to this page, Shared Topic Subscription in WSO2, message delivery to subscribers sharing a client id will be done in round robin order. This article only shows a single MB instance. I am wondering how delivery is managed when you have a cluster of MB instances where there are multiple subscribers sharing a client id across the cluster. Is MB capable of round-robin delivery across all nodes?


Solution

  • WSO2 Message broker is distributed broker. It has slot based delivery model [1]. Slot creation and slot dispatch happen in coordinator node in cluster. Each node has slot delivery worker running to deliver messages to local subscriptions of node.

    So when there are multiple subscriptions across in cluster sharing same subscription id, then local subscriptions of particular node will get messages in round robin order.

    Due to slot architecture, it guarantee that none of two subscriptions will get same message. Because slot contain particular range of message id set.

    Example: Let's say there is two node cluster where node1 and node2. Assume node1 is the coordinator node. There is topic call topic1. Publisher1 send 1000 messages to topic1 in node1 and there are two subscribers in each node call subcriber1, subscriber2 from node1 and subscriber3, subscriber4 from node2. Coordinator node will create slots when messages are publishing and dispatch to subscribers running node on demand. This happen through thrift communication. So all local subscribers in node1 and node2 will get messages round-robin order.

    Hope you might understand high level architecture.

    [1] More details - https://docs.wso2.com/display/MB300/Architecture