Record Class ProcessedKafkaEventId

java.lang.Object
java.lang.Record
com.aim2be.platform.dedup.ProcessedKafkaEventId
Record Components:
consumerScopeId - logical consumer identity, never null or blank
eventId - event UUID rendered as text, never null or blank
weekStart - Monday of the week containing the event's logical timestamp (UTC-normalised), never null
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 as text to 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 same weekStart → same PK → idempotent dedup. It is ALSO the pg_partman partition 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 Details

    • ProcessedKafkaEventId

      public ProcessedKafkaEventId(String consumerScopeId, String eventId, LocalDate weekStart)
      Creates an instance of a ProcessedKafkaEventId record class.
      Parameters:
      consumerScopeId - the value for the consumerScopeId record component
      eventId - the value for the eventId record component
      weekStart - the value for the weekStart record component
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • consumerScopeId

      public String consumerScopeId()
      Returns the value of the consumerScopeId record component.
      Returns:
      the value of the consumerScopeId record component
    • eventId

      public String eventId()
      Returns the value of the eventId record component.
      Returns:
      the value of the eventId record component
    • weekStart

      public LocalDate weekStart()
      Returns the value of the weekStart record component.
      Returns:
      the value of the weekStart record component