EventStorageEngine
implementation:aggregateIdentifier
and sequenceNumber
(unique index)eventIdentifier
(unique index)aggregateIdentifier
column.eventIdentifier
(unique index)sagaType
, associationKey
and associationValue
,sagaId
and sagaType
,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.
@GeneratedValue
anntation./META-INF/orm.xml
on 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 DomainEventEntry
table uses its own sequence. This can be ensured by specifying a different sequence generate for that entity only.@PostConstruct
annotated method, called ensureIndexes
which will generate the indexes required for correct operation. That means, when running in a container that automatically calls @PostConstruct
handlers, the required unique index on "Aggregate Identifier" and "Event Sequence Number" is created when the Event Store is created.RollbackConfiguration
on 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.snapshotFilter
comes in place. It is a Java Predicate
which decides based on DomainEventData
whether a snapshot should be taken into account for processing. If none provided, an implementation which returns always true
is used. snapshotFilter
has to be provided to the EventStorageEngine
: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).DataInputStream
and DataOutputStream
allow you to easily write the contents of the Events to an output stream. The ByteArrayOutputStream
and ByteArrayInputStream
allow writing to and reading from byte arrays.SerializationAware
messages. If a SerializationAware
message is detected, its methods are used to serialize an object, instead of simply passing the payload to a serializer. This allows for performance optimizations.SerializationAware
optimization, use the MessageSerializer
class to serialize the payload and meta data of messages. All optimization logic is implemented in that class. See the JavaDoc of the MessageSerializer
for more details.Serializer
to something different, check out the documentation about Serializers. IdentifierFactory
to generate all the identifiers, whether they are for Events or Commands. The default IdentifierFactory
uses randomly generated java.util.UUID
based 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.IdentifierFactory
file on the classpath,IdentifierFactory
,IdentifierFactory
class, and must