Skip to content

Commit

Permalink
try flush API
Browse files Browse the repository at this point in the history
  • Loading branch information
mas-chen committed Jan 16, 2024
1 parent 3539df6 commit 563f07e
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,12 @@ public static <K, V> void produceToKafka(
};
try (KafkaProducer<K, V> producer = new KafkaProducer<>(props)) {
for (ProducerRecord<K, V> record : records) {
producer.send(record, callback).get();
producer.send(record, callback);
}

producer.flush();
}

if (sendingError.get() != null) {
throw sendingError.get();
}
Expand Down

0 comments on commit 563f07e

Please sign in to comment.