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
16 lines
510 B
Java
16 lines
510 B
Java
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]);
|
|
}
|
|
}
|