-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for additional kafka props on bulk ingest
- Loading branch information
Showing
11 changed files
with
124 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
kaldb/src/main/java/com/slack/kaldb/writer/KafkaUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.slack.kaldb.writer; | ||
|
||
import com.google.common.annotations.VisibleForTesting; | ||
import java.util.Properties; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** Shared kafka functions for producers, consumers, and stream applications */ | ||
public class KafkaUtils { | ||
private static final Logger LOG = LoggerFactory.getLogger(KafkaUtils.class); | ||
|
||
@VisibleForTesting | ||
public static Properties maybeOverrideProps( | ||
Properties inputProps, String key, String value, boolean override) { | ||
Properties changedProps = new Properties(inputProps); | ||
String userValue = inputProps.getProperty(key); | ||
if (userValue != null) { | ||
if (override) { | ||
LOG.warn( | ||
String.format( | ||
"Property %s is provided but will be overridden from %s to %s", | ||
key, userValue, value)); | ||
inputProps.setProperty(key, value); | ||
} else { | ||
LOG.warn( | ||
String.format( | ||
"Property %s is provided but won't be overridden from %s to %s", | ||
key, userValue, value)); | ||
} | ||
} else { | ||
inputProps.setProperty(key, value); | ||
} | ||
return changedProps; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters