Skip to content

Commit

Permalink
[hotfix][examples] Remove System.exit() from Kafka example
Browse files Browse the repository at this point in the history
  • Loading branch information
rmetzger committed Apr 4, 2016
1 parent 0dbe05d commit 93d9384
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* Note: On a cluster, DataStream.print() will print to the TaskManager's .out file!
*
* Please pass the following arguments to run the example:
* --topic test --bootstrap.servers localhost:9092 --group.id myconsumer
* --topic test --bootstrap.servers localhost:9092 --zookeeper.connect localhost:2181 --group.id myconsumer
*
*/
public class ReadFromKafka {
Expand All @@ -39,9 +39,10 @@ public static void main(String[] args) throws Exception {
// parse input arguments
final ParameterTool parameterTool = ParameterTool.fromArgs(args);

if(parameterTool.getNumberOfParameters() < 3) {
System.out.println("Missing parameters!\nUsage: Kafka --topic <topic> --bootstrap.servers <kafka brokers> --group.id <some id>");
System.exit(1);
if(parameterTool.getNumberOfParameters() < 4) {
System.out.println("Missing parameters!\nUsage: Kafka --topic <topic> " +
"--bootstrap.servers <kafka brokers> --zookeeper.connect <zk quorum> --group.id <some id>");
return;
}

StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@
* Generate a String every 500 ms and write it into a Kafka topic
*
* Please pass the following arguments to run the example:
* --topic test --bootstrap.servers localhost:9092 --zookeeper.connect localhost:2181
* --topic test --bootstrap.servers localhost:9092
*
*/
public class WriteIntoKafka {

public static void main(String[] args) throws Exception {
ParameterTool parameterTool = ParameterTool.fromArgs(args);
if(parameterTool.getNumberOfParameters() < 3) {
if(parameterTool.getNumberOfParameters() < 2) {
System.out.println("Missing parameters!");
System.out.println("Usage: Kafka --topic <topic> --bootstrap.servers <kafka brokers> --zookeeper.connect <zk quorum>");
System.exit(1);
System.out.println("Usage: Kafka --topic <topic> --bootstrap.servers <kafka brokers>");
return;
}

StreamExecutionEnvironment env =StreamExecutionEnvironment.getExecutionEnvironment();
Expand Down

0 comments on commit 93d9384

Please sign in to comment.