AF5: AggregateBasedConsistencyMarker.doLowerBound fails with "Not implemented yet"

I am migrating an application using Axon Framework from version 4 to 5. When handling a particular command in the application, the application first loads one (or more) aggregates and reads information from them. Then the primary aggregate is loaded and updated.

Using Axon Framework 5.2.0, this fails with the exception: java.lang.UnsupportedOperationException: Not implemented yet thrown in AggregateBasedConsistencyMarker.doLowerBound (see the stack trace below - I have cut out the part of the stack trace from the application).

The problem seems to be, that you are only able to load a single aggregate per processing context.

One way to solve this problem would be to use a read side to store the information, that is currently read from the (secondary) aggregates. Then the application could read the needed information from this read side and only load the primary aggregate.

However, before implementing this solution I would like to know, if (and possibly when) the functionality needed for loading more than one aggregate in the same processing context will be implemented?

Here is the stack trace:

java.lang.UnsupportedOperationException: Not implemented yet
at org.axonframework.eventsourcing.eventstore.AggregateBasedConsistencyMarker.doLowerBound(AggregateBasedConsistencyMarker.java:80)
at org.axonframework.eventsourcing.eventstore.AggregateBasedConsistencyMarker.doLowerBound(AggregateBasedConsistencyMarker.java:32)
at org.axonframework.eventsourcing.eventstore.AbstractConsistencyMarker.lowerBound(AbstractConsistencyMarker.java:47)
at org.axonframework.eventsourcing.eventstore.DefaultEventStoreTransaction.lambda$updateAppendPosition$4(DefaultEventStoreTransaction.java:152)
at org.axonframework.messaging.core.unitofwork.UnitOfWork$UnitOfWorkProcessingContext.lambda$updateResource$11(UnitOfWork.java:479)
at java.base/java.util.concurrent.ConcurrentHashMap.compute(Unknown Source)
at org.axonframework.messaging.core.unitofwork.UnitOfWork$UnitOfWorkProcessingContext.updateResource(UnitOfWork.java:479)
at org.axonframework.messaging.core.unitofwork.ResourceOverridingProcessingContext.updateResource(ResourceOverridingProcessingContext.java:217)
at org.axonframework.messaging.core.unitofwork.ResourceOverridingProcessingContext.updateResource(ResourceOverridingProcessingContext.java:217)
at org.axonframework.eventsourcing.eventstore.DefaultEventStoreTransaction.updateAppendPosition(DefaultEventStoreTransaction.java:144)
at org.axonframework.eventsourcing.eventstore.DefaultEventStoreTransaction.lambda$source$3(DefaultEventStoreTransaction.java:129)
at org.axonframework.messaging.core.CompletionCallbackMessageStream.onCompleted(CompletionCallbackMessageStream.java:65)
at org.axonframework.messaging.core.AbstractMessageStream.complete(AbstractMessageStream.java:626)
at org.axonframework.messaging.core.AbstractMessageStream.next(AbstractMessageStream.java:544)
at org.axonframework.messaging.core.AbstractMessageStream.peek(AbstractMessageStream.java:499)
at org.axonframework.messaging.core.AbstractMessageStream.hasNextAvailable(AbstractMessageStream.java:489)
at org.axonframework.messaging.core.MessageStreamUtils$Reducer.process(MessageStreamUtils.java:106)
at org.axonframework.messaging.core.AbstractMessageStream.invokeCallbackSafely(AbstractMessageStream.java:651)
at org.axonframework.messaging.core.AbstractMessageStream.setCallback(AbstractMessageStream.java:393)
at org.axonframework.messaging.core.MessageStreamUtils.reduce(MessageStreamUtils.java:78)
at org.axonframework.messaging.core.MessageStream.reduce(MessageStream.java:523)
at org.axonframework.eventsourcing.handler.SimpleEntityLifecycleHandler.source(SimpleEntityLifecycleHandler.java:93)
at org.axonframework.eventsourcing.EventSourcingRepository.lambda$doLoad$4(EventSourcingRepository.java:179)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source)
at org.axonframework.eventsourcing.EventSourcingRepository.doLoad(EventSourcingRepository.java:177)
at org.axonframework.eventsourcing.EventSourcingRepository.load(EventSourcingRepository.java:163)

@Henrik_Norgaard, sorry for the hold-up here. I read your comment when it entered soon enough. I just needed to do a little digging why this isn’t implemented.

Predicament on my end, is that I 100% recall we had a point in the AF5 development cycle where a user was perfectly able to load two aggregate-based entities (so, yea, aggregates really) into a handler and append events.

However, this issue you surfaced shows that is (at least no longer) the case.
The team wasn’t aware either on why this decision was made other than “we perhaps needed more time?”.

All that said, terrible reasons for this support not the exist yet. Given that we’re on the verge of releasing 5.3.0, we sadly cannot incorporate this into that release anymore. However, I’ll ensure we do some investigation why this isn’t supported, to give you a conclusive answer, before 5.4.0 goes out of the door. FYI, 5.4.0 is slated for end of September.

Hope to have given you at least some level of clarity, @Henrik_Norgaard. If anything, sorry for the incovenience at this moment in time!

In the meantime, I can tell you we’ve made an issue describing it, with a straightforward fix attached to it. I am leaning towards “this is good to go”, but need to do some internal checks still. If the fix lands as is, it will be introduced in 5.3.1 of Axon Framework, @Henrik_Norgaard.