Add kafka-streams module: fraud detection topology tested with TopologyTestDriver
Similarity scoring, a 5-minute windowed count that alerts once, and a KTable blocklist join, with the Spring wiring on Spring Boot 4.1.1 and Kafka Streams 4.2.1. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RjfyTgmERTWLqzafu34Cth
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package com.ankurm.streams;
|
||||
|
||||
/** A card transaction. */
|
||||
public record Txn(String card, double amount, int hour, String category) {
|
||||
|
||||
/** Wire format: {@code card,amount,hour,category}. Plain text keeps the serde trivial to read. */
|
||||
public String encode() {
|
||||
return card + "," + amount + "," + hour + "," + category;
|
||||
}
|
||||
|
||||
public static Txn decode(String s) {
|
||||
String[] p = s.split(",", 4);
|
||||
return new Txn(p[0], Double.parseDouble(p[1]), Integer.parseInt(p[2]), p[3]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user