Anonymitaet commented on a change in pull request #5745: Add document for 
sticky consumer 
URL: https://github.com/apache/pulsar/pull/5745#discussion_r350598899
 
 

 ##########
 File path: site2/docs/client-libraries-java.md
 ##########
 @@ -607,6 +607,19 @@ consumer 2 will receive:
 ("key-4", "message-4-2")
 ```
 
+By default, consumer in `Key_Shared` subscription will be assigned a fixed 
hash range of key automatically. If you want to specify the hash ranges of a 
consumer, you can using the key shared policy:
+
+```java
+Consumer consumer = client.newConsumer()
+        .topic("my-topic")
+        .subscriptionName("my-subscription")
+        .subscriptionType(SubscriptionType.Key_Shared)
+                       
.keySharedPolicy(KeySharedPolicy.sticky().ranges(Range.of(0, 10)))
+        .subscribe()
+```
+
+The consumer with specific key hash ranges also can be called a sticky 
consumer. Available key hash range is [0, 65535] , consumers of the 
subscription must cover the whole key hash range and no overlap .
 
 Review comment:
   ```suggestion
   The consumer with a specific key hash range can be called a **sticky 
consumer**. The available key hash range is [0, 65535]. Consumers of a 
subscription must cover the whole key hash range and can not overlap.
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to