Skip to content

[#244] Add snapshot transformation - #815

Merged
hjohn merged 1 commit into
mainfrom
feature/snapshot-transformation
Dec 4, 2026
Merged

hjohn merged 1 commit into
mainfrom
feature/snapshot-transformation

Conversation

@hjohn

@hjohn hjohn commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor
  • Adds SnapshotTransformation: a mapping of the state from one snapshot identity (VersionedType) to another, declared with from(...).to(...).transform(...), or a rename declared with rename(source, target); fromAggregateBased(...).storedBy(converter) starts from an aggregate-based snapshot such as one taken by Axon Framework 4. The chain joins transformations where one leads to the source of another.
  • SnapshotTransformerChain resolves backward from an entity's current type to every identity worth looking up, plus at most one aggregate-based query, and transforms a found snapshot forward. A mapper may drop the snapshot by returning null, which sources the entity in full; a mapper that throws is logged as a warning and sources the entity in full too.
  • SnapshotTransformingEventStore, installed by SnapshotTransformationConfigurationEnhancer when a chain is registered, widens the snapshot lookup and transforms the snapshot found.
  • Event transformation passes snapshots in a sourced stream through untouched.
  • The Snapshotting reference page gains a "Snapshot transformation" section.

AxonIQ/AxonFramework#5369 updates the Axon Framework migration example (no build()); merge it together with this PR. Aggregate-based lookups only find something with a store that serves them; for Axon Server that comes with #683, which in turn waits on unreleased Axon Server API changes.

By doing the above, this PR resolved #244.

This PR should be back ported to axoniq-5.4.x once approved and merged.

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Build status (run 47348969900, commit 55ad89e)

JDK 21 - SUCCESS - 33 modules (33 cached, 0 built) in 00:09

Per-module details
ModuleCacheTime
✅ axoniq-frameworkcached00:00
✅ axoniq-test-loggingcached00:00
✅ axoniq-framework-parentcached00:01
✅ axoniq-framework-bomcached00:00
✅ axoniq-postgresqlcached00:01
✅ axoniq-distributed-messagingcached00:00
✅ axoniq-testcontainercached00:00
✅ axon-server-connectorcached00:00
✅ axoniq-springcloudcached00:00
✅ axoniq-dead-lettercached00:00
✅ axoniq-event-streamingcached00:00
✅ axoniq-multi-tenancycached00:00
✅ axoniq-workflow-parentcached00:00
✅ axoniq-workflow-enginecached00:00
✅ axoniq-tracing-micrometercached00:00
✅ axoniq-workflow-dslcached00:00
✅ axoniq-workflow-testcached00:00
✅ axoniq-framework-springcached00:00
✅ axoniq-spring-boot-autoconfigurecached00:01
✅ axoniq-spring-boot-startercached00:00
✅ axoniq-integrationtestscached00:00
✅ axoniq-integrationtests-supportcached00:00
✅ axoniq-integrationtests-connectorcached00:00
✅ axoniq-integrationtests-conformancecached00:00
✅ axoniq-integrationtests-tracingcached00:00
✅ axoniq-integrationtests-dead-lettercached00:00
✅ axoniq-legacycached00:00
✅ axoniq-integrationtests-legacycached00:00
✅ axoniq-integrationtests-workflowcached00:00
✅ axoniq-legacy-testcached00:00
✅ axoniq-message-transformationcached00:00
✅ axoniq-workflow-dsl-kotlincached00:01
✅ axoniq-docs-samplescached00:00

JDK 25 - SUCCESS - 33 modules (33 cached, 0 built) in 00:13

Per-module details
ModuleCacheTime
✅ axoniq-frameworkcached00:00
✅ axoniq-test-loggingcached00:01
✅ axoniq-framework-parentcached00:01
✅ axoniq-framework-bomcached00:00
✅ axoniq-postgresqlcached00:02
✅ axoniq-distributed-messagingcached00:00
✅ axoniq-testcontainercached00:00
✅ axon-server-connectorcached00:00
✅ axoniq-springcloudcached00:00
✅ axoniq-dead-lettercached00:00
✅ axoniq-event-streamingcached00:00
✅ axoniq-multi-tenancycached00:00
✅ axoniq-workflow-parentcached00:00
✅ axoniq-workflow-enginecached00:00
✅ axoniq-tracing-micrometercached00:00
✅ axoniq-workflow-dslcached00:00
✅ axoniq-workflow-testcached00:00
✅ axoniq-framework-springcached00:00
✅ axoniq-spring-boot-autoconfigurecached00:02
✅ axoniq-spring-boot-startercached00:00
✅ axoniq-integrationtestscached00:00
✅ axoniq-integrationtests-supportcached00:00
✅ axoniq-integrationtests-connectorcached00:00
✅ axoniq-integrationtests-conformancecached00:00
✅ axoniq-integrationtests-tracingcached00:00
✅ axoniq-integrationtests-dead-lettercached00:00
✅ axoniq-legacycached00:00
✅ axoniq-integrationtests-legacycached00:00
✅ axoniq-integrationtests-workflowcached00:00
✅ axoniq-legacy-testcached00:00
✅ axoniq-message-transformationcached00:00
✅ axoniq-workflow-dsl-kotlincached00:01
✅ axoniq-docs-samplescached00:00

@smcvb smcvb changed the title Add snapshot transformation [#244] Add snapshot transformation Nov 24, 2026
@smcvb

smcvb commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Although strictly a feature, marked as a bug since this functionality is currently blocking users migrating their snapshots from AF4 into AF5.

@smcvb smcvb added this to the Release 5.5.0 milestone Nov 24, 2026
@smcvb smcvb added Priority 1: Must Highest priority. A release cannot be made if this issue isn’t resolved. Type: Bug Use to signal issues that describe a bug within the system. labels Nov 24, 2026
@hjohn
hjohn force-pushed the feature/snapshot-transformation branch from b56612c to 173d106 Compare December 1, 2026 12:51
@hjohn
hjohn marked this pull request as ready for review December 1, 2026 12:55
@hjohn
hjohn requested a review from a team as a code owner December 1, 2026 12:55
@hjohn
hjohn requested review from MateuszNaKodach, schananas and smcvb and removed request for a team December 1, 2026 12:55
@hjohn
hjohn force-pushed the feature/snapshot-transformation branch 2 times, most recently from 0f77a81 to 0ffd131 Compare December 1, 2026 14:19
@smcvb
smcvb force-pushed the feature/snapshot-transformation branch from 0ffd131 to b2b219f Compare December 1, 2026 15:22

@smcvb smcvb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enough comments to warrant request changes. I think my biggest concern with this is the rather large deviation from event transformation. I'd prefer we take a similar approach for both as much as possible, as that lowers the cognitive load for both us and users, as things are simply alike.

@MateuszNaKodach MateuszNaKodach left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outside the inline comments: in my Heroes app (Spring Boot, JPA on PostgreSQL) an app without a chain behaves as on main (whole test suite identical), and the pass-through fixes a main bug where an event transformation matching every type broke every snapshot load.

Evidence: probe tests, Heroes end-to-end.

@hjohn
hjohn force-pushed the feature/snapshot-transformation branch from b2b219f to b7557d1 Compare December 2, 2026 13:59
@hjohn
hjohn force-pushed the feature/snapshot-transformation branch 7 times, most recently from bb04db4 to 9d3a38f Compare December 2, 2026 16:41

@MateuszNaKodach MateuszNaKodach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing my remarks :)

@smcvb smcvb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New set of comments. I think the chain-within-chain difference between Snapshot and Event Transformation is my biggest concern.

@smcvb smcvb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concerns have been addressed, hence approving this PR! Some nits here and there, but none of those should block this PR any further.

@hjohn
hjohn force-pushed the feature/snapshot-transformation branch 2 times, most recently from 76a7c3a to dfefcea Compare December 4, 2026 13:29
@hjohn
hjohn enabled auto-merge (rebase) December 4, 2026 13:30
@hjohn
hjohn disabled auto-merge December 4, 2026 13:57
Lifts snapshots stored under an earlier name or version, or aggregate-based
snapshots such as those taken by Axon Framework 4, into an entity's current
type while it is sourced. Event transformation now passes snapshots through
untouched.
@hjohn
hjohn force-pushed the feature/snapshot-transformation branch from dfefcea to 55ad89e Compare December 4, 2026 13:57
@hjohn
hjohn merged commit 0772350 into main Dec 4, 2026
6 checks passed
@hjohn
hjohn deleted the feature/snapshot-transformation branch December 4, 2026 13:59
@hjohn

hjohn commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

/backport axoniq-5.4.x

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Successfully created backport PR for axoniq-5.4.x:

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

Labels

Priority 1: Must Highest priority. A release cannot be made if this issue isn’t resolved. Type: Bug Use to signal issues that describe a bug within the system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Message transformation] Snapshot transformation

3 participants