You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/06/05 02:44:37 UTC

[GitHub] [pulsar] codelipenghui opened a new pull request #7175: [doc] Clarify the impact of batch message in key_shared subscription

codelipenghui opened a new pull request #7175:
URL: https://github.com/apache/pulsar/pull/7175


   Fixes #7121 
   
   ### Motivation
   
   Following the java example at http://pulsar.apache.org/docs/en/client-libraries-java/#key_shared. The messages sometimes may send to only one consumer if the producer sends the batched messages. It's better to clarify in the doc to introduce the right way to use key_shared subscription.
   
   ### Modifications
   
   Update Java client documentation.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] Huanli-Meng commented on a change in pull request #7175: [doc] Clarify the impact of batch message in key_shared subscription

Posted by GitBox <gi...@apache.org>.
Huanli-Meng commented on a change in pull request #7175:
URL: https://github.com/apache/pulsar/pull/7175#discussion_r435714528



##########
File path: site2/docs/client-libraries-java.md
##########
@@ -608,6 +608,22 @@ consumer2 receives the follwoing information.
 ("key-4", "message-4-2")
 ```
 
+If batch enabled at the producer side, messages with different key may add to a batch by default. The broker will dispatch the batch to the consumer, so the default batch mechanism may break the Key_Shared subscription guaranteed message distribution semantics. The producer need to use the `KeyBasedBatcher`.

Review comment:
       ```suggestion
   If batching is enabled at the producer side, messages with different keys are added to a batch by default. The broker will dispatch the batch to the consumer, so the default batch mechanism may break the Key_Shared subscription guaranteed message distribution semantics. The producer needs to use the `KeyBasedBatcher`.
   ```

##########
File path: site2/docs/client-libraries-java.md
##########
@@ -608,6 +608,22 @@ consumer2 receives the follwoing information.
 ("key-4", "message-4-2")
 ```
 
+If batch enabled at the producer side, messages with different key may add to a batch by default. The broker will dispatch the batch to the consumer, so the default batch mechanism may break the Key_Shared subscription guaranteed message distribution semantics. The producer need to use the `KeyBasedBatcher`.
+
+```java
+Producer producer = client.newProducer()
+        .topic("my-topic")
+        .batcherBuilder(BatcherBuilder.KEY_BASED)
+        .create();
+```
+Or the producer can disable the message batch mechanism.

Review comment:
       ```suggestion
   Or the producer can disable batching.
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui commented on pull request #7175: [doc] Clarify the impact of batch message in key_shared subscription

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on pull request #7175:
URL: https://github.com/apache/pulsar/pull/7175#issuecomment-639225186


   @Huanli-Meng Please help review this PR.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui merged pull request #7175: [doc] Clarify the impact of batch message in key_shared subscription

Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #7175:
URL: https://github.com/apache/pulsar/pull/7175


   


----------------------------------------------------------------
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:
users@infra.apache.org