Skip to content

Commit

Permalink
MINOR: ProducerPerformance should work with older client jars
Browse files Browse the repository at this point in the history
Author: Jun Rao <junrao@gmail.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>

Closes #2896 from junrao/minor
  • Loading branch information
junrao authored and ijuma committed Apr 23, 2017
1 parent 1fbb8cf commit b154221
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,24 @@ record = new ProducerRecord<>(topicName, payload);
}
}

// Make sure all messages are sent before printing out the stats and the metrics
producer.flush();
if (!shouldPrintMetrics) {
producer.close();

/* print final results */
stats.printTotal();
/* print final results */
stats.printTotal();
} else {
// Make sure all messages are sent before printing out the stats and the metrics
// We need to do this in a different branch for now since tests/kafkatest/sanity_checks/test_performance_services.py
// expects this class to work with older versions of the client jar that don't support flush().
producer.flush();

/* print final results */
stats.printTotal();

/* print out metrics */
if (shouldPrintMetrics) {
/* print out metrics */
ToolsUtils.printMetrics(producer.metrics());
producer.close();
}
producer.close();
} catch (ArgumentParserException e) {
if (args.length == 0) {
parser.printHelp();
Expand Down

0 comments on commit b154221

Please sign in to comment.