More Features to Love in Axon Framework 5: Event Sourcing That’s Truly Reactive for Modern Applications

The journey continues as we deliver new capabilities in Axon Framework 5.0.0.  With the current release, we are ensuring that we bridge the gap between exciting new features in Axon Framework 5 and the existing feature set within Axon Framework 4, which millions of developers worldwide use. As you may have seen from my previous announcement, Axon Framework 5 supports the groundbreaking capability called Dynamic Consistency Boundary (DCB). DCB is a core feature in the AxonIQ Platform that finally allows the data foundation layer of your applications to be future-proof.  It gives developers more flexibility to adapt their applications and services to changing business requirements without needing to rebuild their systems from scratch. 

One of our main goals with Axon Framework 5 is to ensure developers have the tools to build the most robust and scalable applications and services possible. So, let me introduce you to some new features that get everyone on the development team really excited.

Executive Summary of Axon Framework 5 

  • Significant Cost Reduction Through Resource Optimization - The new asynchronous processing capabilities allow applications to handle substantially more concurrent operations with the same computing resources, directly reducing cloud infrastructure costs and improving ROI on existing hardware investments.

  • Future-Proof Technology Investment—The Dynamic Consistency Boundary (DCB) feature enables applications to adapt to changing business requirements without costly system rebuilds, protecting your technology investments and reducing time to market for new features.

  • Improved Application Performance and Scalability - The async-native architecture eliminates performance bottlenecks under high load, ensuring your applications can scale efficiently to meet growing customer demands without proportional increases in infrastructure spending.

 

The Power of Reactive Event Processing = More Efficiency

What does it mean to have truly reactive event processing in your microservices architecture? At its core, reactive programming allows your application to handle asynchronous data streams more efficiently, enabling better resource utilization and improved scalability. Axon Framework 5 extends our async-native API to encompass Event Processors, allowing developers to write Event Handlers that return reactive types like Mono or Flux from Project Reactor.

This enhancement represents a fundamental shift in how developers can structure their Event Handling logic. Instead of being constrained to imperative, synchronous event handlers, teams can now fully embrace reactive pipelines that align with modern cloud-native architectures. The beauty of this approach lies in its simplicity from the developer's perspective. While we've invested significant effort in rebuilding the underlying infrastructure, developers simply need to change their handler's return type to unlock these capabilities.

Beyond Event Processing: A Complete Reactive Story

The reactive capabilities in Axon Framework 5 extend beyond just event handlers. We've also updated the Axon Server connector to fully support our new async-native API, ensuring that command buses operating through Axon Server can leverage the same reactive patterns. This consistency across different message types—commands, events, and queries—creates a cohesive development experience where reactive and imperative styles coexist based on your specific use case requirements.

But why should you care about reactive programming in your event-sourced applications? Consider a scenario where your event handler needs to enrich incoming events with data from external services before processing. In the traditional imperative code style of Axon Framework 4, each handler is (by default) synchronous. Therefore, your handler code is a potential source for performance bottlenecks under a high load. With the async-native API woven through Axon Framework 5, these operations become non-blocking, allowing your application to handle significantly more concurrent operations with the same resources. This efficiency becomes particularly crucial in cloud environments where resource optimization directly impacts your operational costs.

The bottom line is quite simple: Axon Framework 5 enables your applications and services to be more performant and helps you save money.

 

Introducing Stateful Event Handlers: A Simpler Alternative to Sagas

The most intriguing addition in Axon Framework 5 is the introduction of Stateful Event Handlers. This represents a potentially transformative approach to handling complex business processes that span multiple aggregates. In Axon Framework 4, developers often reach for sagas when coordinating actions across numerous aggregates or implementing time-based business logic. While sagas remain powerful for complex orchestration scenarios, they can feel heavyweight for simpler coordination tasks.

Stateful Event Handlers offer a middle ground. They allow you to automatically inject and work with multiple entities within a single handler, maintaining state across event processing without the full complexity of saga infrastructure. Think of them as a simplified approach to process management—perfect for scenarios where you need to react to events from multiple aggregates and potentially send commands based on accumulated state, but don't require the full orchestration capabilities of sagas.

This is particularly exciting because it aligns with our philosophy of providing the right tool for the right job. Stateful event handlers offer a cleaner, more maintainable solution for simple coordination logic. When your requirements grow to include complex temporal logic or elaborate compensation flows, you can still leverage traditional sagas or integrate with dedicated orchestration platforms if you so choose. This gradual approach to complexity ensures that your codebase remains as simple as possible while meeting your business requirements.

Looking to Get Started with Axon Framework 5? Stay tuned for a Live Coding Event.

The transition to reactive event processing is surprisingly straightforward for teams eager to experiment with these new capabilities. Your existing event handlers continue to work exactly as before—the reactive approach is entirely opt-in. When you're ready to embrace reactive patterns, be sure to look out for a live coding event where I show how to use them properly.

 

Conclusion: Building the Future on a Solid Foundation

By enabling reactive programming patterns in event processing and introducing Stateful Event Handlers as a simpler alternative to sagas, we ensure that Framework 5 provides multiple paths to solving complex distributed systems challenges.

As we continue toward our Q4 release, we invite you to explore these new capabilities in your development environments. Whether you're building new microservices or planning the migration of existing Axon Framework 4 applications, the revised API of Axon Framework 5 provides powerful tools for creating more efficient, scalable event-driven architectures. The Framework's evolution is guided by real-world usage and community feedback, so we encourage you to share your experiences and insights as you experiment with these new capabilities.

Ready to start exploring stateful event handlers in Axon Framework 5? Download the latest release and join us in shaping the future of event-driven architecture. Your journey toward more flexible, scalable, and maintainable distributed systems starts here.


Looking for help on jumpstarting your Event-Sourced app with Axon Framework? Feel free to use this form to book a chat with one of our solution architects and let us know what you’re working on. We’ll happily show you step-by-step on getting your project off the ground. We’re happy to help your organization adapt to Event Sourcing, so feel free to contact us!

 

Steven van Beelen
Lead Developer - Axon Framework. Steven has a keen interest in Axon Framework and how it approaches software architecture. He helps small and large clients build Axon applications, provides training, develops the framework and is active in the Axon community. Broader interests include domain driven design, messaging patterns and event sourcing.
Steven van Beelen

Share: