Trifork Blog

Axon Framework, DDD, Microservices

Axon Framework 2.0 Released!

January 22nd, 2013 by
|

After laying the ground work for this release about a year ago, we now proudly announce the next major release of Axon Framework! The 2.0 release is a big step forward compared to the previous version, as it contains a thorough restructuring of components, making it even easier to build scalable and extensible applications.

About Axon Framework

With growing user communities and on-line activity, application developers need to cope with problems related to concurrency and scalability. The market moves quickly, and the ability to react swiftly is crucial for a business’ existence. With today’s elastic cloud solutions, companies are able to be flexible in how they scale their hardware, and the Axon Framework hereby makes sure your software solution scales too!

Many applications built in a traditional style expect the database to take on the scalability task. Axon Framework addresses these issues right in the core architecture. That’s why, once an application is built, scaling up an Axon based application is merely a matter of configuration. Axon Framework’s software architecture approach doesn’t only address scalability, it addresses five common challenges that applications very often face: Scalability, Agility, Performance, Security and Integration. Not just as a side effect or add-on, but right from its core.

Axon’s ability to address these common issues in applications makes it useful in various applications and domains. It has been used in complex trading systems in the banking industry, electronic medical records in the healthcare domain as well as in the online gaming industry. While each application has different requirements, they can all be found in the Axon Framework, making it incredibly easy to develop scalable, high performance software applications.

New in Axon 2

Thanks to the contributions of the community backing Axon, we’ve managed to make large improvements. First and foremost, the API is now a lot simpler, yet more powerful. We’ve also managed to squeeze more processing out of Axon, making applications run faster on the same hardware. And finally, we’ve included components that you can use to scale dynamically at runtime.

Easier, more powerful API

Axon tries to minimize the amount of Axon specific code in your domain model. In Axon 1, Command objects were merely POJOs sent over a Command Bus. Events, however, needed to extend from an Axon class. In Axon 2, Events are pojos as well. When published, they are wrapped in messages, on which Axon specific information is attached. Despite the advantages, you don’t have to work with these messages.

Methods annotated with @CommandHandler and @EventHandler are now much more flexible. Not only can you have the payload of a message (i.e. your actual Command or Event object) passed as a parameter, you can also inject specific meta data values or the message’s timestamp. If you’re a Spring Framework user, you can even inject Spring Beans in your methods, simply by adding them as a parameter. The resolution process of these parameters is customizable, allowing you to write your own parameter resolvers.

The Command Bus provides a low-level API to dispatch Command Messages to your command handlers. Axon 2 allows you to define a CommandGateway, which acts as a higher level interface towards a Command Bus. To create a gateway, all you need to do is provide Axon with an interface. The implementation is automatically generated based on the method signatures. This way, you can easily define meta-data values to be added to the command, as well as dispatch-and-wait-for-result style operations.

Axon 2 comes with a much more powerful and yet easier to use API for Event Upcasting. You can choose the representation of the serialized Event you prefer to work with, such as a String, byte[] or a Dom4J document. The available formats depend on the serializer you use (e.g. using Dom4J requires an XML-based serializer), but can easily be extended by implementing custom Data Converters. Axon 2 will automatically combine available Converters to translate one representation to another, even if that cannot be done by a single converter.

Performance improvements

Some applications have performance needs that simply outgrow the characteristics of the SimpleCommandBus. For those applications, Axon 2 comes with a high performance Command Bus that uses a lockless algorithm to process commands using multiple threads. This implementation is capable of processing 4 times more commands than the SimpleCommandBus implementation, while only using 2 or 3 threads.

When reading Events, either from the Event Store when reconstructing aggregate state, or from a remotely invoked Event Handler, Axon will automatically determine whether it is necessary to deserialize the Event Message. This greatly reduces the amount of processing needed to reconstruct aggregates that don’t require all events. The same is valid for upcasters, they are only invoked when Axon detects that the result of their transformation is actually needed.

When processing Commands, the generated events are often written to an Event Store and published to an Event Bus. When both use the same serializer, Axon can ensure that serialization is done only once, using the same result for both operations. Your application specific code is completely unaffected. All you need to do is enable the feature in your configuration.

Replaying large numbers of events (>10 Million) is now much faster. Furthermore, it is also possible to define a selection of events to replay, such as events that occurred within a certain period of time, or Events that have been applied on a specific type of aggregate. Improvements in the queries executed as well as the deserialize-when-needed algorithm will make replaying events drastically faster.

Axon generates unique identifiers for all messages. By default, the generated values are java.util.UUID instances. While they generate as-good-as-never-colliding identifiers, the performance is not great. For applications requiring high-performance, it is possible to hook in a custom identifier generator. For example one that generates version 1 UUIDs.

Out of the box scalability support

Besides the basic implementations of building blocks, Axon 2 comes with some out-of-the-box implementations that allow you to horizontally scale an application.

The Distributed Command Bus with the JGroups Connector allows you to scale horizontally, completely at runtime. Scale your command handlers up and down to match the load on your application. Axon takes into account that some machines may be more powerful than others, spreading the load accordingly.

Events can be distributed over AMQP (version 0.9.1) by using the Spring AMQP terminal. It will ensure that Events are transported to the Event Listeners over AMQP . While this implementation requires Spring, another implementation will soon be available that uses a plain AMQP client.

MongoDB Event Store

The MongoEventStore is now a full member of the Axon family. This means you can safely use a Mongo Database, which is built to store large amounts of data, as an Event Store. Axon 2 also comes with a Serializer that allows the MongoEventStore to store events as BSON structures, so that you can easily query your Event store for specific event details.

Upcoming events

Axon 2 Launch Seminar

To celebrate the release, we are organizing a free seminar, in which we will show how Axon Framework helps to develop scalable and extensible software using the CQRS architectural pattern.

The adoption of CQRS is a strategic choice in the battle against growing complexity of scalable applications. This makes Axon more than just a developer framework. The seminar targets Software Architects and IT Managers, and focuses on the business value of CQRS and Axon Framework. Don’t take our word for it, two companies will present a case study, in which they show how they benefit from Axon.

The first case study will be presented by E.Novation, a European ICT company that connects people, systems and organizations. One of their solutions is AZERA, an application to manage care registration and declarations for the healthcare industry. E.Novation will explain how Axon helps them react to changes in the Dutch law faster, while keeping application complexity at bay.

The second case study is presented by Aktive Reply, an Italian company, part of the European Reply Group. After having used Axon in several projects, among which a top 50 bank, they have extracted a set of best practices, and bundled them in a product which they use to serve their other customer faster.

There will also be an open forum, in which a panel of experts will present their vision on CQRS and software development in general, based on questions from the audience.

Event details:
Location: De Observant, Amersfoort, Netherlands
Date & time: Feb 28th, 12:30 – 18:00
Price: free, registration required

Space is limited, so register now.

Swiss Java Usergroup – Axon 2 Presentation

On March 12th, the Swiss Java User Group (JUGS) will host a presentation about CQRS and Axon. In this presentation, Allard Buijze, the creator of Axon Framework, will give an overview of CQRS and Axon, and how it is used to develop scalable software.

Event details:
Location: Technopark, Zürich, Switzerland
Date & time: March 12th, 16:00 – 17:00
Price: free for JUGS members
For more information and registration, visit jug.ch

Workshops

We have also planned a number of CQRS and Axon workshops. In the one-day workshop, you will learn how to build a scalable application using Axon 2. The workshops contain both theory and practice, so that you can apply the new ideas and concepts immediately.

Currently, we have two workshops planned for March:

  • March 13th, Zürich, Switzerland
  • March 21st, Amsterdam, The Netherlands

For more information and registration, visit axonframework.org/workshop.

If you are interested in a workshop or training in another location or at another time, don’t hesitate to contact us.

More information & getting started

If you want to get started using Axon, visit www.axonframework.org. In the downloads section, you’ll find the 2.0 download package. If you use Maven, you can simply update your dependencies to use version 2.0.

If you have any questions about Axon, you can ask them on the Axon Framework User Mailing list (axonframework@googlegroups.com). If you have found bugs, or want to report a feature request, don’t hesitate to let us know through the Issue Tracker.

Enjoy!

Comments are closed.