Jav*_*era 6 apache-kafka kafka-producer-api
查看文档,我不确定我是否理解使用close()和lush()之间的区别。
这是flush()的文档
Run Code Online (Sandbox Code Playgroud)* Invoking this method makes all buffered records immediately available to send (even if <code>linger.ms</code> is * greater than 0) and blocks on the completion of the requests associated with these records. The post-condition * of <code>flush()</code> is that any previously sent record will have completed (e.g. <code>Future.isDone() == true</code>). * A request is considered completed when it is successfully acknowledged * according to the <code>acks</code> configuration you have specified or else it results in an error.
以及 close() 的文档:
Run Code Online (Sandbox Code Playgroud)* This method waits up to <code>timeout</code> for the producer to complete the sending of all incomplete requests. * If the producer is unable to complete all requests before the timeout expires, this method will fail * any unsent and unacknowledged records immediately.
这是否意味着:
我想如果我在 1. 中是正确的,那么 acks=0 的生产者将获得一条记录的确认,如果该记录“不幸”被放置在内存队列中,则该记录甚至可能不会被尝试发布,并且调用 close() 后立即执行。
| 归档时间: |
|
| 查看次数: |
4557 次 |
| 最近记录: |