Skip to content

Commit

Permalink
Update SampleProducer.java (#623)
Browse files Browse the repository at this point in the history
  • Loading branch information
minuhong-aws authored Jan 13, 2025
2 parents cbdfba0 + a2094d1 commit dca8d6c
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ public void run() {
//
// Records are also automatically flushed by the KPL after a while based
// on the time limit set with Configuration.setRecordMaxBufferedTime()
//
// Note: DO NOT trigger the flushSync() method to every time you write
// data to Kinesis Data Streams. Doing so can add substantial extra
// latency, around 500ms per write. The flushSync() operation is designed
// for shutdown scenarios to make sure that all buffered records are
// sent before the KPL application terminates.
// See the below link for details.
// https://docs.aws.amazon.com/streams/latest/dev/troubleshooting-producers.html#misuse-tag
log.info("Waiting for remaining puts to finish...");
producer.flushSync();
log.info("All records complete.");
Expand Down

0 comments on commit dca8d6c

Please sign in to comment.