[
https://issues.apache.org/jira/browse/KAFKA-7326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16594559#comment-16594559
]
ASF GitHub Bot commented on KAFKA-7326:
---------------------------------------
huxihx opened a new pull request #5579: KAFKA-7326: KStream.print() should
flush on each line for PrintStream
URL: https://github.com/apache/kafka/pull/5579
https://issues.apache.org/jira/browse/KAFKA-7326
PrintForeachAction should flush for PrintStream after printing the line.
*More detailed description of your change,
if necessary. The PR title and PR message become
the squashed commit message, so use a separate
comment to ping reviewers.*
*Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.*
### Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Let KStream.print() to flush on each printed line
> -------------------------------------------------
>
> Key: KAFKA-7326
> URL: https://issues.apache.org/jira/browse/KAFKA-7326
> Project: Kafka
> Issue Type: Improvement
> Components: streams
> Affects Versions: 2.0.0
> Reporter: Guozhang Wang
> Priority: Major
> Labels: newbie++
>
> Today, {{KStream.print()}} is implemented as a special "foreach" function as
> below:
> {code}
> @Override
> public void apply(final K key, final V value) {
> final String data = String.format("[%s]: %s", label,
> mapper.apply(key, value));
> printWriter.println(data);
> }
> {code}
> Note that since {{this.printWriter = new PrintWriter(new
> OutputStreamWriter(outputStream, StandardCharsets.UTF_8));}}, without
> flushing the writer we do not guarantee that printed lines are written to the
> underlying `outputStream` in time.
> Since {{KStream.print()}} is mainly for debugging / testing / demoing
> purposes, not for performance, I think it is okay to enforce auto flushing.
> This would include:
> 1. set {{autoFlush}} in the constructor of printWriter.
> 2. document in java-docs of {{KStream.print}} that this is for debug /
> testing purposes only, and it will try to flush on each record print, and
> hence should not be used for production usage if performance requirement is
> key.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)