MINOR: remove unused variable in examples#14021
Conversation
| package kafka.examples; | ||
|
|
||
| public class KafkaProperties { | ||
| public static final String TOPIC = "topic1"; |
There was a problem hiding this comment.
can you please look into when this was added and why it wasn't used? Unused variables can sometimes hint towards bugs where we are not using variables when we should.
There was a problem hiding this comment.
@divijvaidya Thank you so much for the review
When this class is created on it's earlier version, it stored all related properties needed to run all examples this is an example of what is was when created
final static String zkConnect = "127.0.0.1:2181";
final static String groupId = "group1";
final static String topic = "topic1";
final static String kafkaServerURL = "localhost";
final static int kafkaServerPort = 9092;
final static int kafkaProducerBufferSize = 64*1024;
final static int connectionTimeOut = 100000;
final static int reconnectInterval = 10000;
final static String topic2 = "topic2";
final static String topic3 = "topic3";
final static String clientId = "SimpleConsumerDemoClient";**
Then it was cleaned, and intended to keep configuration needed to run Kafka,
There was a problem hiding this comment.
@divijvaidya I think even the two variables needs to be refactored since they are used only once and for the exactly once semantic example and can be replaced by one variable the contains the bootstrapServers instead of concatenating three strings to build a boostrapServers url
public static final String KAFKA_SERVER_URL = "localhost";
public static final int KAFKA_SERVER_PORT = 9092;
I think I can update this PR cover this point
There was a problem hiding this comment.
@divijvaidya I updated my pull request and made some suggestions like reusing BOOTSTRAP_SERVERS property in all examples when it's needed
Please can you review it again
|
Unrelated test failures: |
divijvaidya
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
* ak/trunk: (110 commits) MINOR: Update docs to include ZK deprecation notice and information (apache#14031) KAFKA-15091: Fix misleading Javadoc for SourceTask::commit (apache#13948) KAFKA-14669: Use the generated docs for MirrorMaker configs in the doc (apache#13658) KAFKA-14953: Add tiered storage related metrics (apache#13944) KAFKA-15121: Implement the alterOffsets method in the FileStreamSourceConnector and the FileStreamSinkConnector (apache#13945) Revert "MINOR: Update .asf.yaml file with refreshed github_whitelist, and collaborators" (apache#14037) MINOR: Update .asf.yaml file with refreshed github_whitelist, and collaborators KAFKA-14737: Move kafka.utils.json to server-common (apache#13585) KAFKA-14647: Move TopicFilter to server-common/utils (apache#13158) MINOR: remove unused variable in examples (apache#14021) ...
Reviewers: Divij Vaidya <diviv@amazon.com>
Reviewers: Divij Vaidya <diviv@amazon.com>
Reviewers: Divij Vaidya <diviv@amazon.com>
this is a too minor pull request, and it consists of removing unused variables in examples
Committer Checklist (excluded from commit message)