Asynchronous Unit Of Work

Currently, a CompletableFuture returned from CommandHandlers is treated as normal return value and the current Unit Of Work commits immediately. Is there a way for the Unit Of Work to wait for the CompletableFuture to completed before it is committed? This would allow the Unit Of Work to properly reflect the lifecycle and delay any published events from committing until the command operation is completed.

My answer here can be pretty short.
For Axon Framework 4, the answer is no.
For Axon Framework 5, the answer is yes.

As it stands, we are hard at work to get AF5 in a milestone state. Nonetheless, the renewed Unit of Work (currently called the ProcessingLifecycle for AF5) supports both a synchronous and asynchronous style of message handlers.

So, I hope this isn’t bad news for you, @cneuwirt. It might just mean y ou need to migrate a potentially large AF4 project just for this functionality. In the end though, I guess it’s good to know that AxonIQ is working on that level of support.

That’s great news and it would definitely be worth any migration efforts.

1 Like

Out of curiosity, is there any timeline for Axon 5 release?

We aim for a milestone somewhere in Q2.
Everything beyond that is, to be honest, an uncertainty to me :slight_smile:
What I do dare to say, is that it’ll happen this year.

Great. Looking forward!

1 Like