卡夫卡(Kafka)对批处理写道有什么保证(如果有的话)可以保证



现在,我们现在将其中一项服务从通过传统通信技术推动数据到Apache Kafka。
当前的逻辑是将消息发送给IBM MQ并在发生错误时重试。我想重复一遍,但是我对经纪人在这种情况下提供的保证是什么都不知道。
假设我通过Java客户端库通过生产者在批处理中发送了100条消息。假设它达到了群集,是否有可能接受部分(例如,磁盘已满,或者我在写作中触摸的某些分区都被恢复不足(?我可以从生产者中检测到这个问题,并仅重试的那些不接受的消息吗?
我搜索了kafka atomicity guarantee,但空着,可能有一个众所周知的术语

当您说一批发送100条消息时,您是说,您想控制此数量的消息,或者可以让生产者批处理一定数量的消息,然后发送批处理?

由于不确定您可以控制一个生产者批处理中生产的消息的数量,因此API会排队并为您批量批处理,但不能保证将它们全部批处理在一起(虽然我会检查一下(。

如果您可以为您提供一定数量的API批次,请参阅以下一些线索。

与生产者打交道时,卡夫卡(Kafka

如本幻灯片帖子所述:https://www.slideshare.net/miguno/apache-kafka-08-basic-training-verisign(83(

The original list of messages is partitioned (randomly if the default partitioner is used) based on their destination partitions/topics, i.e. split into smaller batches. 
Each post-split batch is sent to the respective leader broker/ISR (the individual send()’s happen sequentially), and each is acked by its respective leader broker according to request.required.acks

关于原子性。.不确定整个批次在上述行为上是否被视为原子。也许您可以保证使用每个消息将使用相同的密钥发送到同一分区,因此可以成为Atomic

如果您在制作确认规则时需要更清楚,则此处按照此处所述的工作方式https://docs.confluent.io/current/current/clients/producer.html:

You can control the durability of messages written to Kafka through the acks setting. 
The default value of "1" requires an explicit acknowledgement from the partition leader that the write succeeded. 
The strongest guarantee that Kafka provides is with "acks=all", which guarantees that not only did the partition leader accept the write, but it was successfully replicated to all of the in-sync replicas.

您也可以环顾生产者启用。如果您在生产时没有重复的目标,则掌握行为。

yannick

相关内容

最新更新