Anonymitaet commented on code in PR #514:
URL: https://github.com/apache/pulsar-site/pull/514#discussion_r1165221519


##########
docs/concepts-messaging.md:
##########
@@ -515,16 +515,64 @@ Exclusive is the default subscription type.
 
 #### Failover
 
-In the *Failover* type, multiple consumers can attach to the same 
subscription. A master consumer is picked for a non-partitioned topic or each 
partition of a partitioned topic and receives messages. When the master 
consumer disconnects, all (non-acknowledged and subsequent) messages are 
delivered to the next consumer in line.
+In the *Failover* type, multiple consumers can attach to the same 
subscription. 
 
-* For partitioned topics, the broker will sort consumers by priority level and 
lexicographical order of consumer name. The broker will try to evenly assign 
partitions to consumers with the highest priority level.
-* For non-partitioned topics, the broker will pick consumers in the order they 
subscribe to the non-partitioned topics.
+A master consumer is picked for a non-partitioned topic or each partition of a 
partitioned topic and receives messages. 
 
-For example, a partitioned topic has 3 partitions, and 15 consumers. Each 
partition will have 1 active consumer and 4 stand-by consumers.
+When the master consumer disconnects, all (non-acknowledged and subsequent) 
messages are delivered to the next consumer in line.
 
-In the diagram below, **Consumer A** is the master consumer while **Consumer 
B** would be the next consumer in line to receive messages if **Consumer A** is 
disconnected.
+##### Failover | Partitioned topics
 
-![Failover subscriptions](/assets/pulsar-failover-subscriptions.svg)
+For partitioned topics, the broker sorts consumers by priority level and 
lexicographical order of consumer name. 
+
+The broker tries to evenly assign partitions to consumers with the highest 
priority level. 
+
+A consumer is selected by running a module operation `mod (partition index, 
consumer index)`.
+
+- If the number of partitions in a partitioned topic is **less** than the 
number of consumers:
+  
+  For example, in the diagram below, this partitioned topic has 2 partitions 
and there are 4 consumers. 
+  
+  Each partition has 1 active consumer and 1 stand-by consumer. 
+  
+    - For p0, Consumer A is the master consumer, while Consumer B would be the 
next consumer in line to receive messages if Consumer A is disconnected.
+
+    - For p1, Consumer C is the master consumer, while Consumer D would be the 
next consumer in line to receive messages if Consumer C is disconnected.
+
+  ![Failover subscriptions](/assets/pulsar-failover-subscriptions-4.svg)
+
+- If the number of partitions in a partitioned topic is **greater** than the 
number of consumers:
+  
+  For example, in the diagram below, this partitioned topic has 9 partitions 
and 3 consumers. 
+  
+  - p0, p3, and p6 are assigned to consumer A.
+  
+  - p1, p4, and p7 are assigned to consumer B.
+  
+  - p2, p5, and p8 are assigned to consumer C.
+  
+  ![Failover subscriptions](/assets/pulsar-failover-subscriptions-1.svg)
+##### Failover | Non-partitioned topics
+
+- If there is one non-partitioned topic. The broker picks consumers in the 
order they subscribe to non-partitioned topics. 
+
+  For example, in the diagram below, this non-partitioned topic has 1 topic 
and there are 2 consumers. 
+  
+  The topic has 1 active consumer and 1 stand-by consumer. 
+  
+  Consumer A is the master consumer, while Consumer B would be the next 
consumer in line to receive messages if Consumer A is disconnected.
+
+  ![Failover subscriptions](/assets/pulsar-failover-subscriptions-2.svg)
+
+- If there are multiple non-partitioned topics, a consumer is selected based 
on **consumer name hash** and **topic name hash**. The client uses the same 
consumer name to subscribe to all the topics.
+
+  For example, in the diagram below, there are 4 non-partitioned topics and 2 
consumers. 
+  
+  - The non-partitioned topic 1 and non-partitioned topic 4 are assigned to 
Consumer B. 

Review Comment:
   I prefer to keep it to make the info more clear (it's not a redundancy) 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to