WarningIt is highly recommended to store all timestamps in UTC format. In countries with Daylight Savings Time, storing timestamps in local time may result in sorting errors for events generated around and during the timezone switch. This does not occur when UTC is used. Some servers are configured to always use UTC. Alternatively, you should configure the Event Store to convert timestamps to UTC before storing them.
/META-INF/orm.xmlon the classpath, which looks as follows:
metadata-complete="false", as this indicates this file should be used to override existing annotations, instead of replacing them. For the best results, ensure that the
DomainEventEntrytable uses its own sequence. This can be ensured by specifying a different sequence generate for that entity only.
@PostConstructannotated method, called
ensureIndexeswhich will generate the indexes required for correct operation. That means, when running in a container that automatically calls
@PostConstructhandlers, the required unique index on "Aggregate Identifier" and "Event Sequence Number" is created when the Event Store is created.
RollbackConfigurationon your Command Bus. By default, the Unit Of Work will be rolled back on runtime exceptions for Command handlers, and on all exceptions for Event Handlers.
snapshotFiltercomes in place. It is a Java
Predicatewhich decides based on
DomainEventDatawhether a snapshot should be taken into account for processing. If none provided, an implementation which returns always
snapshotFilterhas to be provided to the
XStreamSerializer, there are some quick wins ready to pick up. XStream allows you to configure aliases for package names and event class names. Aliases are typically much shorter (especially if you have long package names), making the serialized form of an event smaller. And since we're talking XML, each character removed from XML is twice the profit (one for the start tag, and one for the end tag).
DataOutputStreamallow you to easily write the contents of the Events to an output stream. The
ByteArrayInputStreamallow writing to and reading from byte arrays.
SerializationAwaremessages. If a
SerializationAwaremessage is detected, its methods are used to serialize an object, instead of simply passing the payload to a serializer. This allows for performance optimizations.
SerializationAwareoptimization, use the
MessageSerializerclass to serialize the payload and meta data of messages. All optimization logic is implemented in that class. See the JavaDoc of the
MessageSerializerfor more details.
Serializerto something different, check out the documentation about Serializers.
IdentifierFactoryto generate all the identifiers, whether they are for Events or Commands. The default
IdentifierFactoryuses randomly generated
java.util.UUIDbased identifiers. Although they are very safe to use, the process to generate them doesn't excel in performance.
/META-INF/services/org.axonframework.common.IdentifierFactory". Java's ServiceLoader mechanism will detect that file and attempt to create an instance of the class named inside.
IdentifierFactory. The implementation must
/META-INF/services/org.axonframework.common.IdentifierFactoryfile on the classpath,
IdentifierFactoryclass, and must