Package com.aim2be.platform.outbox
Class OutboxRecord
java.lang.Object
com.aim2be.platform.outbox.OutboxRecord
Transactional outbox row, per ADR-0014 D-4.
Compound primary key (aggregate_id, event_id) mirrors the
service-side primary-aggregate naming convention. status drives the
poller's PENDING → SENT → ARCHIVED transitions; retries
tracks transient broker failures; payload_bytes carries the
Avro-serialised event body (length-prefixed wire format negotiated via
com.aim2be.platform.schema.SchemaRegistryClient).
The @Version field enforces optimistic locking — see
com.aim2be.platform.archunit.EntityVersionParity ArchRule (ADR-0001
§1.4).
v1.0 scaffold: getter/setter bodies are present (Lombok rejected for the v1.0 surface — explicit accessors make the entity contract auditable from the bytecode). Production behaviour ships in PR-PLATFORM-1.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classCompound primary key forOutboxRecord.static enumPer-row lifecycle. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMaximum length of thelast_errorcolumn. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanIdentity is the compound PK(aggregateId, eventId); equals and hashCode purposefully exclude all mutable fields per JPA best practice (avoids identity flipping whenstatus/recordVersiontransitions inside a transaction).byte[]longintintgetTopic()inthashCode()voidsetAggregateId(UUID aggregateId) voidsetCreatedAt(Instant createdAt) voidsetEventId(UUID eventId) voidsetLastError(String lastError) Sets the last-error message, truncating toLAST_ERROR_MAX_LENGTHcharacters when longer (avoids DB constraint violations from unbounded Kafka exception stacks).voidsetPayloadBytes(byte[] payloadBytes) voidsetRecordVersion(long recordVersion) voidsetRetries(int retries) voidsetSchemaVersion(int schemaVersion) voidvoidsetStatus(OutboxRecord.Status status) voidtoString()
-
Field Details
-
LAST_ERROR_MAX_LENGTH
public static final int LAST_ERROR_MAX_LENGTHMaximum length of thelast_errorcolumn. Producer-side relay and poller truncate longer error messages to this width before persisting (avoids unbounded growth from verbose Kafka exception stacks).- See Also:
-
-
Constructor Details
-
OutboxRecord
public OutboxRecord()
-
-
Method Details
-
getAggregateId
-
setAggregateId
-
getEventId
-
setEventId
-
getStatus
-
setStatus
-
getRetries
public int getRetries() -
setRetries
public void setRetries(int retries) -
getPayloadBytes
public byte[] getPayloadBytes() -
setPayloadBytes
public void setPayloadBytes(byte[] payloadBytes) -
getTopic
-
setTopic
-
getSchemaVersion
public int getSchemaVersion() -
setSchemaVersion
public void setSchemaVersion(int schemaVersion) -
getCreatedAt
-
setCreatedAt
-
getSentAt
-
setSentAt
-
getLastError
-
setLastError
Sets the last-error message, truncating toLAST_ERROR_MAX_LENGTHcharacters when longer (avoids DB constraint violations from unbounded Kafka exception stacks).- Parameters:
lastError- the raw error message; may benullto clear
-
getRecordVersion
public long getRecordVersion() -
setRecordVersion
public void setRecordVersion(long recordVersion) -
equals
Identity is the compound PK(aggregateId, eventId); equals and hashCode purposefully exclude all mutable fields per JPA best practice (avoids identity flipping whenstatus/recordVersiontransitions inside a transaction). -
hashCode
public int hashCode() -
toString
-