CodeDrivenMitch/axon-open-admin

NPE when sequencingPolicy does not return a sequenceIdentifier

Closed this issue · 1 comments

I have several DeadLetterEntries, which do no have an aggregateIdentifier (they got a sequenceIdentifier though).

When I open the DQL details view, I get an error:

2022-11-21 06:43:01.538 ERROR 1 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "org.axonframework.eventhandling.async.SequencingPolicy.getSequenceIdentifierFor(Object)" is null] with root cause

java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "org.axonframework.eventhandling.async.SequencingPolicy.getSequenceIdentifierFor(Object)" is null
    at com.insidion.axon.openadmin.dlq.DlqActionEndpoint$processorMessages$1.invoke(DlqActionEndpoint.kt:33)
    at com.insidion.axon.openadmin.EndpointService.ifReady(EndpointService.kt:38)
    at com.insidion.axon.openadmin.dlq.DlqActionEndpoint.processorMessages(DlqActionEndpoint.kt:25)

Looking into it, it seems that this statement fails:

val sequence = sequencingPolicy.getSequenceIdentifierFor(firstMessage).toString()

because the default SequentialPerAggregatePolicy returns null. The DeadLetteringEventHandlerInvoker takes the event.identifier in that case, basically making the sequenceIdentifier the same as the message.identifier.

Axon-Admin should apply the same behavior.

I just released 0.2.4 containing this fix. I applied this fix to the filter of the retry mechanism as well, otherwise, no messages would match.
It should be on maven central in a minute or 15. Thanks a lot of supplying a fix