feature(migration): migrate routingKey for @Command's #4704
Conversation
|
|
abuijze
left a comment
There was a problem hiding this comment.
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}, |
There was a problem hiding this comment.
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.
Solves #4701