Skip to content

AF5 model inspection - expose AF5 entity inspection over RSocket#146

Open
stefanmirkovic wants to merge 2 commits intorelease/2.0.5-SNAPSHOTfrom
feature/af5-model-inspection
Open

AF5 model inspection - expose AF5 entity inspection over RSocket#146
stefanmirkovic wants to merge 2 commits intorelease/2.0.5-SNAPSHOTfrom
feature/af5-model-inspection

Conversation

@stefanmirkovic
Copy link
Copy Markdown
Contributor

@stefanmirkovic stefanmirkovic commented Apr 20, 2026

Adds RSocketModelInspectionResponder with four endpoints backed by AF5's StateManager and EventStorageEngine:

  • MODEL_REGISTERED_ENTITIES: entity types + ID types + structural id-field descriptors from StateManager (drives the dynamic Entity ID form on the frontend)
  • MODEL_DOMAIN_EVENTS: paginated events for a given entity
  • MODEL_ENTITY_STATE_AT_SEQUENCE: state reconstruction at any sequence
  • MODEL_REPLAY_TIMELINE: chunked timeline (offset + limit) with stateBefore / event / stateAfter per entry

Tag keys are resolved from @eventsourced / @EventSourcedEntity annotations (including meta-annotations), falling back to the class's simple name. State reconstruction walks the full event stream to keep stateBefore accurate for the first event in the requested window, but only serializes snapshots for entries in [offset, offset + limit), bounding payload size regardless of stream length.

AxoniqPlatformModelInspectionEnhancer registers the responder via the ConfigurationEnhancer SPI. SetupPayloadCreator now reports hasStateManager so the platform can detect model inspection support.

Compound id + multi-tag support

Replaces the hand-crafted EventCriteria.havingTags(Tag.of(tagKey, entityId))
(single-tag only, breaks for multi-tag entities) with a delegation to the
framework's own CriteriaResolver:

  • resolveCriteria(entityType, entityId) extracts the live resolver from the
    registered EventSourcingRepository via reflection, honoring any custom
    resolver the application has configured. Falls back to constructing a fresh
    AnnotationBasedEventCriteriaResolver(entityClass, idClass, configuration)
    • the AF5 default path - and only as a last resort to the legacy single-tag
      lookup
  • Resolvers are cached per (entityClass, idClass) pair
  • describeIdFields(idClass) introspects records, Kotlin data classes / POJOs,
    and @JvmInline value class wrappers. Simple types (String/primitives/UUID/
    enums/BigInteger/BigDecimal) return an empty descriptor list so the frontend
    keeps a single input
  • deserializeEntityId handles primitives directly, unwraps Kotlin value
    classes through their public constructor, and lets Jackson deserialize
    JSON-encoded compound ids into the real typed id before invocation
  • Responder now also takes a Configuration parameter (wired through the
    enhancer) so it can build resolvers on demand
  • ProcessingContext is passed as null - verified safe for the default
    annotation-based resolver which doesn't read it; custom resolvers that do
    throw NPE, which is caught and falls back to the legacy path (no regression)

Relates: https://github.com/AxonIQ/axoniq-platform/pull/538

@stefanmirkovic stefanmirkovic self-assigned this Apr 20, 2026
@stefanmirkovic stefanmirkovic added the Backend This issue contains backend changes label Apr 20, 2026
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend This issue contains backend changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant