Architecture & audit-record model
jEAP Audit centers on the Avro message type CreateAuditRecordCommand (artifact
ch.admin.bit.jeap.messagetype.jeap:create-audit-record-command, generated types under
ch.admin.bit.jeap.audit.record.create.*). The three production modules play different roles around
that command:
jeap-audit-command-builder— builds aCreateAuditRecordCommand.jeap-spring-boot-audit-starter-transactional-outbox— sends the command over Kafka with at-least-once delivery via the transactional outbox.jeap-audit-command-consumer— converts a received command into the plain JavaAuditRecordmodel.
The command structure
A CreateAuditRecordCommand carries a publisher (service / system, set from the Kafka properties or
explicit builder arguments), an optional processId, and a CreateAuditRecordCommandPayload with:
timestamp— when the audited action happened.event(AuditEventDetails) — thetype(AuditEventType), an optionalcontext(useCase+processId) and an optional list of free-formeventDatakey/value elements.trigger— either anAuditUser(id,identityProvider) or anAuditSystemComponent(department,system,component). Exactly one must be set.auditedData(AuditObject, optional) — the object the action applied to:type,id, optionalversionand a list ofobjectDataentries (value, JSON or S3 reference; each with an optionalAuditObjectDataRoleofNEWorOLD).
AuditEventType values are CREATED, READ, LISTED, MODIFIED, DISCLOSED, DESTROYED,
DELETED and UNKNOWN (the builder default).
The consumer model
AuditRecordFactory.createAuditRecord(command) flattens the Avro command into an immutable
AuditRecord record, hiding the Avro union/builder types behind plain Java:
| Avro source | Consumer model type |
|---|---|
| publisher + payload timestamp | AuditRecord (serviceName, systemName, timestamp) |
AuditEventDetails | AuditEvent (eventType, AuditContext, event-data list) |
AuditUser / AuditSystemComponent trigger | AuditTriggerUser / AuditTriggerSystemComponent |
AuditObject + its data entries | AuditObject with AuditObjectDataValue/JSON/S3 subtypes |
See Consuming audit commands for details.