Skip to content

Commit

Permalink
Merge pull request #20 from US-ELRR/updatesseth
Browse files Browse the repository at this point in the history
added whitelist filter to kafka message stream
  • Loading branch information
smednickd authored Jan 30, 2024
2 parents c32f1e0 + fe16957 commit dd332e2
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;

import com.deloitte.elrr.elrrconsolidate.InputSanatizer;
import com.deloitte.elrr.elrrconsolidate.dto.LearnerChange;
import com.deloitte.elrr.elrrconsolidate.dto.MessageVO;
import com.deloitte.elrr.elrrconsolidate.entity.ELRRAuditLog;
Expand Down Expand Up @@ -36,9 +37,14 @@ public class ELRRMessageListener {
*/
@KafkaListener(topics = "${kafka.topic}", groupId = "${kafka.groupId}")
public void listen(final String message) {
log.info("Received Messasge in group - group-id: " + message);
LearnerChange learnerChange = getLearnerChange(message);
messageService.process(learnerChange);
if (InputSanatizer.isValidInput(message)) {
log.info("Received Messasge in group - group-id: " + message);
LearnerChange learnerChange = getLearnerChange(message);
messageService.process(learnerChange);
} else {
log.warn("Invalid message did not pass whitelist check - "
+ message);
}
}

/**
Expand Down

0 comments on commit dd332e2

Please sign in to comment.