Skip to content

feature(migration): migrate routingKey for @Command's #4704

Open
klauss42 wants to merge 1 commit into
AxonIQ:mainfrom
klauss42:feat/migration-routingKey
Open

feature(migration): migrate routingKey for @Command's #4704
klauss42 wants to merge 1 commit into
AxonIQ:mainfrom
klauss42:feat/migration-routingKey

Conversation

@klauss42

@klauss42 klauss42 commented Jul 3, 2026

Copy link
Copy Markdown

Solves #4701

@klauss42 klauss42 requested a review from a team as a code owner July 3, 2026 08:35
@klauss42 klauss42 requested review from MateuszNaKodach, jangalinski and zambrovski and removed request for a team July 3, 2026 08:36
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@abuijze abuijze 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.

The change looks good. It does surface one minor issue, though. It may accidentally choose the wrong field when both the RoutingKey and TargetAggregateIdentifier annotations are present on a message.

* Returns the name of the first field / record component that carries an AF4 or AF5
* {@code @RoutingKey} annotation, walking both the primary-constructor record components and
* the class body. Returns {@code null} if no such field exists.
* Returns the name of the first field / record component that carries an {@code @RoutingKey},

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.

Strictly speaking, we should give @RoutingKey annotated fields precedence over @TargetAggregateIdentifier.

In this example:

public record ReassignCommand(
    @TargetEntityId String orderId,   // declared first → picked
    @RoutingKey     String shardKey   // AF4 would have routed on THIS
) {}

the orderId field would be picked, while Axon 4 would have used shardKey as the routing key.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants