From ad5d6d0b8bdcfc7417336b0289fadb5528c5a601 Mon Sep 17 00:00:00 2001 From: John Hendrikx Date: Wed, 2 Dec 2026 15:06:37 +0100 Subject: [PATCH] Use the renamed snapshot transformation API in the migration docs (cherry picked from commit 2e2879173ce7ee965562a63151fbc686043b4e0b) --- .../migration/pages/paths/snapshotting.adoc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/reference-guide/modules/migration/pages/paths/snapshotting.adoc b/docs/reference-guide/modules/migration/pages/paths/snapshotting.adoc index 3aac472fef..b8deb14eb8 100644 --- a/docs/reference-guide/modules/migration/pages/paths/snapshotting.adoc +++ b/docs/reference-guide/modules/migration/pages/paths/snapshotting.adoc @@ -141,7 +141,7 @@ When a context runs on Dynamic Consistency Boundary (DCB) storage, Axon Server k Axon Server stores such an _aggregate-based snapshot_ under the identifier of its aggregate, positioned in the context-wide event stream, and identified by its payload type (the aggregate class) and revision. An Axon Framework 5 application can start from these snapshots instead of replaying an entity's full history. -An aggregate-based snapshot holds Axon Framework 4 aggregate state, in the format it was serialized with, so it is lifted into the entity type explicitly, through a snapshot transformation: +An aggregate-based snapshot holds Axon Framework 4 aggregate state, in the format it was serialized with, so it is transformed into the entity type explicitly, through a snapshot transformation: [source,java,role=pseudocode] ---- @@ -151,7 +151,7 @@ xStream.alias("com.example.bank.BankAccount", LegacyAccount.class); SnapshotTransformerChain chain = SnapshotTransformerChain.builder() .register(SnapshotTransformation - .pathFromAggregateBased(VersionedType.of("com.example.bank.BankAccount", "0.0.0")) + .fromAggregateBased(VersionedType.of("com.example.bank.BankAccount", "0.0.0")) .storedBy(new XStreamConverter(xStream)) .to(VersionedType.of("com.example.bank.Account", "1.0.0")) .transform(LegacyAccount.class, legacy -> new Account(legacy.id, legacy.balance)) @@ -161,18 +161,18 @@ SnapshotTransformerChain chain = SnapshotTransformerChain.builder() configurer.componentRegistry(registry -> registry.registerComponent(SnapshotTransformerChain.class, c -> chain)); ---- -* `pathFromAggregateBased` names the payload type and revision of the Axon Framework 4 snapshots to start from. +* `fromAggregateBased` names the payload type and revision of the Axon Framework 4 snapshots to start from. A snapshot without a revision has version `0.0.0`. -Register a path for each revision you can read. +Register a transformation for each revision you can read. * `storedBy` declares the converter the snapshot was serialized with. Axon Framework 4 serializes snapshots with XStream by default, which the `XStreamConverter` of the `axoniq-legacy` module reads. * `to` and `transform` map the stored state into the entity type, identified by its name and version. -Registering the chain is all that is needed: when an entity is sourced, Axon Framework 5 also asks Axon Server for the aggregate-based snapshot of its identifier, and lifts it before the entity sees it. +Registering the chain is all that is needed: when an entity is sourced, Axon Framework 5 also asks Axon Server for the aggregate-based snapshot of its identifier, and transforms it before the entity sees it. Rules for aggregate-based snapshots: -* An aggregate-based snapshot is only used when its payload type and revision match a declared path. +* An aggregate-based snapshot is only used when its payload type and revision match a declared transformation. Any other snapshot stored under the same aggregate identifier, such as one of a revision you did not declare, is passed over, and the entity is sourced in full. * An aggregate-based snapshot is only looked for when the entity has no snapshot of its own. Once sourced, the entity writes and uses snapshots of its own type, even when Axon Framework 4 keeps writing newer ones. @@ -191,11 +191,11 @@ For Axon Framework 4 to see the events Axon Framework 5 appends to the same enti === Without a transformation -Without a declared path, existing Axon Framework 4 snapshots are not used: affected entities rebuild from a full event replay, and fresh snapshots are written from then on. +Without a declared transformation, existing Axon Framework 4 snapshots are not used: affected entities rebuild from a full event replay, and fresh snapshots are written from then on. This is not a correctness problem: a snapshot is only an optional cache, and every entity can be rebuilt from its event stream. It is a performance one, and the cost depends on your domain. Until fresh snapshots accumulate, each affected entity is sourced from its full history, so the first load after migration is slower. For short streams this is negligible, but an entity with a long stream, hundreds of thousands or millions of events, can suffer a significant response-time hit. -Assess the impact against your longest-lived entities, and declare a path for those whose replay would be too slow. +Assess the impact against your longest-lived entities, and declare a transformation for those whose replay would be too slow. For the storage engine choices that decide whether a context runs in aggregate-based or DCB mode, see the xref:migration:paths/event-store.adoc[Event Store migration].