lhotari commented on code in PR #878:
URL: https://github.com/apache/pulsar-site/pull/878#discussion_r1553787770
##########
docs/concepts-messaging.md:
##########
@@ -427,6 +427,13 @@ Consumer<byte[]> consumer = pulsarClient.newConsumer()
.subscribe();
```
+:::note
+
+Send messages by synchronous API `send` will disable batching, and the message
will be sent individually.
+It is for the purpose of reducing the latency of sending messages and
preventing blocking of the producer thread.
Review Comment:
This is not accurate. "producer thread" is vague in this case. is it an
internal thread or what thread is it referring to? I guess a well known concept
is "caller's thread" or "calling thread". However, the explanation would have
be be better.
One explanation is simply that before the send message returns, the batch
would have to be sent and the broker would have to return a message id for the
sent message. In most usecases, no more messages could be added to the same
batch since the caller thread is blocked so the decision has been made to
simply trigger immediate sending of the message when the synchronous API is
used.
I'm not exactly sure how to put this in the docs.
##########
docs/concepts-messaging.md:
##########
@@ -427,6 +427,13 @@ Consumer<byte[]> consumer = pulsarClient.newConsumer()
.subscribe();
```
+:::note
+
+Send messages by synchronous API `send` will disable batching, and the message
will be sent individually.
Review Comment:
This comment isn't accurate. The batching isn't disabled. The current batch
is triggered immediately after sending the message.
https://github.com/apache/pulsar/blob/ffff639a1b73a34bbb5115503d4c7783bb2a2770/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TypedMessageBuilderImpl.java#L82-L86
--
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]