Skip to content

Commit

Permalink
Merge pull request #286 from jembi/CU-86bzpxg72_Update-Kafka-key---Co…
Browse files Browse the repository at this point in the history
…mbine-given-and-family-name

Cu 86bzpxg72 update kafka key   combine given and family name
  • Loading branch information
MatthewErispe authored Jul 25, 2024
2 parents acd5d0a + 4e5eb87 commit c9765e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,15 @@ private void apacheReadCSV(
.findFirst()
.orElse("");

String partitionKey;
String partitionKey = "";
if (!givenName.isEmpty()) {
partitionKey = new Soundex().soundex(givenName);
} else if (!familyName.isEmpty()) {
partitionKey = new Soundex().soundex(familyName);
} else {
partitionKey = "Unknown";
partitionKey += new Soundex().soundex(givenName);
}
if (!familyName.isEmpty()) {
partitionKey += new Soundex().soundex(familyName);
}
if (givenName.isEmpty() && familyName.isEmpty()) {
partitionKey += "Unknown";
}
LOGGER.info("Kafka topic/partition for patient: " + partitionKey);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ private void closeInteractionStream() {

private Properties loadConfig() {
final Properties props = new Properties();
props.put(StreamsConfig.PROCESSING_GUARANTEE_CONFIG, StreamsConfig.EXACTLY_ONCE_V2);
props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, AppConfig.KAFKA_BOOTSTRAP_SERVERS);
props.put(StreamsConfig.APPLICATION_ID_CONFIG, AppConfig.KAFKA_APPLICATION_ID_INTERACTIONS + topic);
return props;
Expand Down

0 comments on commit c9765e0

Please sign in to comment.