You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: extensions/mongo.md
+51-6Lines changed: 51 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,11 +16,15 @@ Note that there is always a balance between query optimization and update speed.
16
16
17
17
Put a \(unique\) index on the `"sagaIdentifier"` in the saga \(default name: `"sagas"`\) collection. Put an index on the `"sagaType"`, `"associations.key"` and `"associations.value"` properties in the saga \(default name: `"sagas"`\) collection.
18
18
19
+
* Dead letter queue
20
+
21
+
Put a \(unique\) index on the combination of `"processingGroup"`, `"sequenceIdentifier"` and `"index"` in the dead letter \(default name: `"deadletters"`\) collection. Put an index on the `"processingGroup"`, and `"sequenceIdentifier"` properties in the dead letter \(default name: `"deadletters"`\) collection. Put an index on the `"processingGroup"` property in the dead letter \(default name: `"deadletters"`\) collection.
22
+
19
23
{% hint style="info" %}
20
-
In pre Axon Framework 3 release we found MongoDb to be a very good fit as an Event Store. However with the introduction of Tracking Event Processors and how they track their events, we have encountered some inefficiencies in regards to the Mongo Event Store implementation. We recommend using a built-for-purpose event store like [Axon Server](../axon-server-introduction.md), or alternatively an RDBMS based \(the JPA or JDBC implementations for example\), and would only suggest to use Mongo for this use case if you have found its performance to be beneficial for your application.
24
+
In pre Axon Framework 3 release we found MongoDb to be a very good fit as an Event Store. However, with the introduction of Tracking Event Processors and how they track their events, we have encountered some inefficiencies regarding the Mongo Event Store implementation. We recommend using a built-for-purpose event store like [Axon Server](../axon-server-introduction.md), or alternatively an RDBMS based \(the JPA or JDBC implementations for example\), and would only suggest to use Mongo for this use case if you have found its performance to be beneficial for your application.
21
25
{% endhint %}
22
26
23
-
## Configuration in Spring Boot
27
+
## Configuration of the Event Store with Spring
24
28
25
29
```java
26
30
@Configuration
@@ -41,14 +45,55 @@ public class AxonConfig {
41
45
42
46
// The MongoEventStorageEngine stores each event in a separate MongoDB document.
This extension can be added as a Spring Boot starter dependency to your project using group id `org.axonframework.extensions.mongo` and artifact id `axon-mongo-spring-boot-starter`. When using the autoconfiguration, by default the following components will be created for you automatically:
64
+
* A `MongoTransactionManager` to enable transactions with Mongo.
65
+
* A `SpringMongoTransactionManager`, this is the wrapped Spring mongo transaction manager, and will also be injected where applicable in other components created by the auto-config.
66
+
* A `SpringMongoTemplate`, this will use a `MongoDatabaseFactory` that should be available. To use transaction with Mongo the collections need to be accessed in a certain way, and this component makes sure of that.
67
+
* A `MongoTokenStore`, this will be used by the event processors to can keep track which events have been processed, and which segments are claimed.
68
+
* A `MongoSagaStore`, this will be used to store and retrieve saga's.
69
+
70
+
It's also possible to autoconfigure the `StorageStrategy` and `EventStorageEngine` by setting the `mongo.event-store.enabled` to true. The creation of the token store and the saga store can be turned off by setting `mongo.token-store.enabled` or `mongo.saga-store.enabled` to false. It's also possible to use a different database for the axon collections than the default the `MongoDatabaseFactory` uses by setting the `axon.mongo.database-name` property.
71
+
72
+
## Configuration of the Mongo Dead-Letter Queue with Spring
73
+
74
+
See [Dead-Letter Queue](../axon-framework/events/event-processors/README.md#dead-letter-queue) for the general information about the Dead-Letter Queue.
0 commit comments