The new axon incubator and the google app engine project

by Jettro CoenradieJuly 6, 2011

Some time ago we started adding modules or classes to axon that were not really the core of the system. The most important one of them is a MongoDB based event store. The amount of testing of this module was not as high as the other parts. It has not yet been tested in a production system. Still it was part of the core of Axon. Next to the MongoDB based event store we also developed a Google App Engine based event store. This was not in the core of axon, in fact it was only part of a sample project in Github. A few weeks a go we decided it would be better to add an incubator to axon and put these modules or classes that have not been tested as well as the core of axon in there. THe third module is the experimentation of Allard with a distributed command bus. Feel free to check out the code and use it or comment on it through the mailing list. But be warned that this code is under development and might therefore be less stable than the other parts of axon.

This blog post focusses on the Google App Engine module that can now be found in the incubator. I’ll summarize the required changes to the axon framework so it can be used on google app engine. I did blog about this topic before, so I am not going into details for all the code, but point to the older blogpost where possible and focus on the new stuff.

Overview

In my previous blogpost I discussed the following topics.

  • Gradle for building the sample
  • XStream (the used serializer) hacks required for google app engine. Things have changed in this area, I will discuss them later on.
  • Event store based on the RAW google app engine storage api. Only the package has changed.
  • Other technologies for the sample like: Spring web, Spring security and sitemesh
  • ?

So what has changed since that blog post?

New dependencies

We can now find the latest and greatest gae artifacts in the central repository and we have moved to the latest jdk (1.5.1). Next to the google app engine dependencies we now also have a dependency on the incubator module from axon. The following block shows the most important changes in the dependencies for the gradle build file. Have a look at the build.gradle file for the complete config.

    compile "org.axonframework:axon-core:$axonVersion",
            "org.axonframework.incubator:axon-googleappengine:1.1-SNAPSHOT",
            "com.google.appengine:appengine-api-1.0-sdk:$gaeVersion"

I also removed the gae lab dependency. This was required for the task api, but in 1.5.1 the task api has become a standard module for google app engine.

Axon incubator module for google app engine

What does the incubator module for google app engine provide? it contains additions for serialization, the event store and command/event bus implementations. In the future the event and command bus implementations will not be needed. We are going to make changes in the statistics part of axon.

Serialization

This part contains two classes. We have a utility class for Spring enabled applications. This is the XStreamFactory class. This factory initializes GaeExtream class with a PureJavaReflectionProvider. Some of the default providers that XStream usually uses are not supported on Google App Engine. Therefore we have our own GaeXStream class. When writing the previous blog post there was no way to provide your own instance of an XStream class. This has changed since then. Now we can provide our own XStream class. Therefore we do not need the GaeGenericXStreamSerializer and XStreamEventSerializer anymore.

Event store

Not a lot to mention here. I was pretty detailed in the other blog post. We have three classes required for the event store. We have the object to store, the EventEntry. Next to the entry we have The GaeEventStore and the GaeSnapshotter.

Event and Command bus

In the current snapshot version of axon, the SimpleCommandBus and the SimpleEventBus are MBean enabled. This class is not in the supported classes of GoogleAppEngine. Therefore we have to create our own event and command bus. They both are exact copies without the marker interface and the statistics stuff.

The sample project

The CompanyHr project is a google app engine project that makes use of axon. The google app engine hacks are now in the axon incubator module. Therefore we have removed them from the sample project. The sample makes use of basic spring mvc and it integrates the spring security module with google authentication.

All web related technologies have been mentioned in the previous blog post. Therefore I do not explain them here again.

Concluding

Integrating with Google app engine is not hard. We do have to make a few changes that are supported by axon. The only thing that is not very nice is the statistics problems. But we will come with a solution in that area as well.

If you still have questions or remarks, feel free to post a comment or use the axon user group.

References