package com.ankurm.kafkabasics; import java.math.BigDecimal; import java.time.Instant; /** * The payload. A record works as a Kafka value with no annotations at all, because Jackson 3 * handles records natively — but note that it needs a canonical constructor the * deserializer can call, which is the one thing a record gives you for free and a Lombok * {@code @Builder}-only class does not. * * @param orderId the partition key. Same customer, same order, same partition, same order of * delivery — see docs/04-keys-and-partitions.md */ public record OrderEvent(String orderId, String customerId, BigDecimal amount, Instant placedAt) { public static OrderEvent of(String orderId, String customerId, String amount) { return new OrderEvent(orderId, customerId, new BigDecimal(amount), Instant.parse("2026-08-29T10:15:30Z")); } }