I am working on migrating an application using AF4 to AF5 (version 5.1.1). The application has an event handler with methods annotated with @EventHandler. The event handler methods have an argument annotated with @SequenceNumber. Here is an example:
@EventHandler public void apply(Renamed event, @SequenceNumber Long version, @Timestamp Instant timestamp) {
When this event handler is called, the version is null. If I define the method argument as a long instead of a Long, the result is a NullPointerException.
I am aware that as documented here, it is only possible to use the SequenceNumber annotation when the event was created from an aggregate. That should be the case in my application.
I have been debugging the problem and it seems that the legacy resource keys (e.g. AGGREGATE_SEQUENCE_NUMBER_KEY) are added to the context in AggregateBasedJpaEventStorageEngine, but when MethodInvokingMessageHandlingMember is called, they are not there.
Can you help me find out, what I am doing wrong?