You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Luke Chen (Jira)" <ji...@apache.org> on 2023/02/24 05:08:00 UTC

[jira] [Updated] (KAFKA-14752) improve kafka examples under examples package

     [ https://issues.apache.org/jira/browse/KAFKA-14752?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luke Chen updated KAFKA-14752:
------------------------------
    Description: 
A good example in a open source project is really important. This is usually the entry point when new users trying to develop Kafka client applications. We should improve the quality of the example files.

 

Kafka provided some examples under "examples" package. Currently we provided
 * java-producer-consumer-demo, which is to produce 10000 records and then consume all of them
 * exactly-once-demo, which is to produce records -> consume -> process  -> consume.

Among them, the base component is producer and consumer. However, I found the producer and consumer example is not in a good form. For example:
 # Both consumer and producer doesn't gracefully close the resource after completed
 # The example doesn't provide a good example to handle different kind of exceptions. It's just a happy path example
 # No clear comment to instruct users why we should do this, and what it is doing for each operation.

 

Furthermore, while running both the examples, I saw flood of logs output because we print one line for message sent, and one line for message received. In java-producer-consumer-demo, there will be 10000 records sent/received, so > 20000 lines of logs output. Same for exactly-once-demo. Maybe we should consider to reduce the record number.

 

One more thing, in exactly-once-demo.java, there are clear class java doc in the demo file, but there's nothing in java-producer-consumer-demo.java. We should also improve that.

 

 

 

  was:
Kafka provided some examples under "examples" package. Currently we provided
 * java-producer-consumer-demo, which is to produce 10000 records and then consume all of them
 * exactly-once-demo, which is to produce records -> consume -> process  -> consume.

Among them, the base component is producer and consumer. However, I found the producer and consumer example is not in a good form. For example:
 # Both consumer and producer doesn't gracefully close the resource after completed
 # The example doesn't provide a good example to handle different kind of exceptions. It's just a happy path example
 # No clear comment to instruct users why we should do this, and what it is doing for each operation.

 

Furthermore, while running both the examples, I saw flood of logs output because we print one line for message sent, and one line for message received. In java-producer-consumer-demo, there will be 10000 records sent/received, so > 20000 lines of logs output. Same for exactly-once-demo. Maybe we should consider to reduce the record number.

 

One more thing, in exactly-once-demo.java, there are clear class java doc in the demo file, but there's nothing in java-producer-consumer-demo.java. We should also improve that.

 

 


> improve kafka examples under examples package
> ---------------------------------------------
>
>                 Key: KAFKA-14752
>                 URL: https://issues.apache.org/jira/browse/KAFKA-14752
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: Luke Chen
>            Priority: Major
>              Labels: newbie, newbie++
>
> A good example in a open source project is really important. This is usually the entry point when new users trying to develop Kafka client applications. We should improve the quality of the example files.
>  
> Kafka provided some examples under "examples" package. Currently we provided
>  * java-producer-consumer-demo, which is to produce 10000 records and then consume all of them
>  * exactly-once-demo, which is to produce records -> consume -> process  -> consume.
> Among them, the base component is producer and consumer. However, I found the producer and consumer example is not in a good form. For example:
>  # Both consumer and producer doesn't gracefully close the resource after completed
>  # The example doesn't provide a good example to handle different kind of exceptions. It's just a happy path example
>  # No clear comment to instruct users why we should do this, and what it is doing for each operation.
>  
> Furthermore, while running both the examples, I saw flood of logs output because we print one line for message sent, and one line for message received. In java-producer-consumer-demo, there will be 10000 records sent/received, so > 20000 lines of logs output. Same for exactly-once-demo. Maybe we should consider to reduce the record number.
>  
> One more thing, in exactly-once-demo.java, there are clear class java doc in the demo file, but there's nothing in java-producer-consumer-demo.java. We should also improve that.
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)