Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ private static String[] addEnvironmentVariablesArguments(final String[] args) {
return allArgs.toArray(String[]::new);
}

/**
* This variable is usually set on application start. When the application is running in debug mode it is used to
* reconfigure the child app package logger. On default it points to the package of this class allowing to execute
* the run method independently.
*/
private static String appPackageName = KafkaStreamsApplication.class.getPackageName();

/**
* <p>This methods needs to be called in the executable custom application class inheriting from
* {@link KafkaStreamsApplication}.</p>
Expand All @@ -84,14 +91,16 @@ private static String[] addEnvironmentVariablesArguments(final String[] args) {
* @param args Arguments passed in by the custom application class.
*/
protected static void startApplication(final KafkaStreamsApplication app, final String[] args) {
appPackageName = app.getClass().getPackageName();
final String[] populatedArgs = addEnvironmentVariablesArguments(args);
CommandLine.run(app, System.out, populatedArgs);
}

@Override
public void run() {
if(this.debug) {
if (this.debug) {
org.apache.log4j.Logger.getLogger("com.bakdata").setLevel(Level.DEBUG);
org.apache.log4j.Logger.getLogger(appPackageName).setLevel(Level.DEBUG);
}
log.debug(this.toString());
final var kafkaProperties = this.getKafkaProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ public class WordCount extends KafkaStreamsApplication {

@CommandLine.Option(names = "--output-topic", required = true)
private String outputTopic = "";


public static void main(final String[] args) {
startApplication(new WordCount(), args);
}

@Override
public void buildTopology(final StreamsBuilder builder) {
final Serde<String> stringSerde = Serdes.String();
Expand Down