Package com.aim2be.platform.dedup
Record Class ProcessedKafkaEventId
java.lang.Object
java.lang.Record
com.aim2be.platform.dedup.ProcessedKafkaEventId
- Record Components:
consumerScopeId- logical consumer identity, nevernullor blankeventId- event UUID rendered as text, nevernullor blankweekStart- Monday of the week containing the event's logical timestamp (UTC-normalised), nevernull
- All Implemented Interfaces:
Serializable
@Embeddable
public record ProcessedKafkaEventId(String consumerScopeId, String eventId, LocalDate weekStart)
extends Record
implements Serializable
Composite primary key for
ProcessedKafkaEvent, per ADR-0014 D-4.
Components:
consumerScopeId— canonical service name (e.g."family-service"). For per-pod broadcast consumers (notification-service push delivery) callers MAY pass a pod-suffixed scope (e.g."notification-service-pod-7") to enable per-pod dedup without breaking the schema — see ADR-0014 §L-12.eventId— unique event identifier from the Kafka message headers. UUIDv7 for minted events (timestamp-ordered, k-sortable) and UUIDv3 for deterministic events (e.g.TicketExpired). Stored astextto remain agnostic of mint scheme — the dedup contract only needs equality.weekStart— Monday of the ISO week containing the event's logical timestamp (NOT the consumer's ingestion clock). This is the L-10 stability boundary: reprocessing a topic from offset 0 produces the sameweekStart→ same PK → idempotent dedup. It is ALSO thepg_partmanpartition key (weekly RANGE) per §L-7 / §L-8.
Authored as a Java 17 record — Hibernate ORM 6.4+ (Spring Boot
3.3+ → 3.5.14 in this scaffold) supports records as @Embeddable via
the canonical constructor. The record gives us equals, hashCode,
toString and a Serializable marker for free, which JPA's
composite-id contract requires.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionProcessedKafkaEventId(String consumerScopeId, String eventId, LocalDate weekStart) Creates an instance of aProcessedKafkaEventIdrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theconsumerScopeIdrecord component.final booleanIndicates whether some other object is "equal to" this one.eventId()Returns the value of theeventIdrecord component.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.Returns the value of theweekStartrecord component.
-
Constructor Details
-
ProcessedKafkaEventId
Creates an instance of aProcessedKafkaEventIdrecord class.- Parameters:
consumerScopeId- the value for theconsumerScopeIdrecord componenteventId- the value for theeventIdrecord componentweekStart- the value for theweekStartrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
consumerScopeId
Returns the value of theconsumerScopeIdrecord component.- Returns:
- the value of the
consumerScopeIdrecord component
-
eventId
Returns the value of theeventIdrecord component.- Returns:
- the value of the
eventIdrecord component
-
weekStart
Returns the value of theweekStartrecord component.- Returns:
- the value of the
weekStartrecord component
-