leiless edited a comment on issue #10832: URL: https://github.com/apache/pulsar/issues/10832#issuecomment-856694634
@lhotari, many thanks for your reply. For the [`flush()`](https://pulsar.apache.org/api/client/2.7.0-SNAPSHOT/org/apache/pulsar/client/api/Producer.html#flush--) method, my use case turns out to be: * Producer `.maxPendingMessages(10_000)` * Producer `.blockIfQueueFull(true)` * I have many messages to be sent, publish throughput `>= 10_000 msgs/s` * Use `sendAsync()` for the first `[0, N-1] msgs` and **still** forget the `CompletableFuture<MessageId>` * **[NEW]** Use `sendAsync()` & `flush()` for the last messages, (i.e. the `N`-th message) to ensure the whole `N` messages persisted in the Pulsar broker. My question is, is the above solution is fine to use? or does it conform best practice in such heavy load? The biggest problem is that I read bulk data from an infinite stream, which is very fast(`>= 60_000 items/s`), and then send those data into Pulsar broker. If I use `send()` for each message, the publish throughput can be extermely degraded. -- 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: [email protected]
