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
* Add large snapshot payload support
* Refactor class name
* fix snapshot plugin class name in test config
* Add load time measurement
* Add GridFS snapshot example
* downgrade sample to net6.0, make project not packable
* Fix unit test
* Remove transaction, use native GridFS driver
* Add GridFS documentation
---------
Co-authored-by: Aaron Stannard <[email protected]>
Copy file name to clipboardexpand all lines: README.md
+28-8
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,11 @@
2
2
3
3
Akka Persistence journal and snapshot store backed by MongoDB database.
4
4
5
-
### Setup
5
+
> [!NOTE]
6
+
>
7
+
> The MongoDB operator to limit the number of documents in a query only accepts an integer while akka provides a long as maximum for the loading of events during the replay. Internally the long value is cast to an integer and if the value is higher than Int32.MaxValue, Int32.MaxValue is used. So if you have stored more than 2,147,483,647 events for a single PersistenceId, you may have a problem :wink:
8
+
9
+
## Setup
6
10
7
11
To activate the journal plugin, add the following lines to actor system configuration file:
Remember that connection string must be provided separately to Journal and Snapshot Store. To finish setup simply initialize plugin using: `MongoDbPersistence.Get(actorSystem);`
24
28
25
-
###Configuration
29
+
## Configuration
26
30
27
-
Both journal and snapshot store share the same configuration keys (however they resides in separate scopes, so they are definied distinctly for either journal or snapshot store):
31
+
Both journal and snapshot store share the same configuration keys (however they reside in separate scopes, so they are defined distinctly for either journal or snapshot store):
28
32
29
33
```hocon
30
34
akka.persistence {
@@ -127,9 +131,9 @@ akka.persistence {
127
131
}
128
132
```
129
133
130
-
###Programmatic configuration
134
+
## Programmatic configuration
131
135
132
-
You can programmatically overrides the connection string setting in the HOCON configuration by adding a `MongoDbPersistenceSetup` to the
136
+
You can programmatically override the connection string setting in the HOCON configuration by adding a `MongoDbPersistenceSetup` to the
133
137
`ActorSystemSetup` during `ActorSystem` creation. The `MongoDbPersistenceSetup` takes `MongoClientSettings` instances to be used to configure
134
138
MongoDB client connection to the server. The `connection-string` settings in the HOCON configuration will be ignored if any of these `MongoClientSettings`
135
139
exists inside the Setup object.
@@ -178,7 +182,8 @@ var setup = BootstrapSetup.Create()
178
182
var actorSystem = ActorSystem.Create("actorSystem", setup);
179
183
```
180
184
181
-
### Serialization
185
+
## Serialization
186
+
182
187
[Going from v1.4.0 onwards, all events and snapshots are saved as byte arrays using the standard Akka.Persistence format](https://github.com/akkadotnet/Akka.Persistence.MongoDB/issues/72).
183
188
184
189
However, in the event that you have one of the following use cases:
@@ -205,5 +210,20 @@ Setting `legacy-serialization = on` will allow you to save objects in a BSON for
205
210
206
211
**WARNING**: However, `legacy-serialization = on` will break Akka.NET serialization. `IActorRef`s, Akka.Cluster.Sharding, `AtLeastOnceDelivery` actors, and other built-in Akka.NET use cases can't be properly supported using this format. Use it at your own risk.
207
212
208
-
### Notice
209
-
- The MongoDB operator to limit the number of documents in a query only accepts an integer while akka provides a long as maximum for the loading of events during the replay. Internally the long value is cast to an integer and if the value is higher then Int32.MaxValue, Int32.MaxValue is used. So if you have stored more then 2,147,483,647 events for a single PersistenceId, you may have a problem :wink:
213
+
# Large Snapshot Store Support
214
+
215
+
MongoDb limits the size of documents it can store to 16 megabytes. If you know you will need to store snapshots larger than 16 megabytes, you can use the `Akka.Persistence.MongoDb.Snapshot.MongoDbGridFSSnapshotStore` snapshot store plugin.
216
+
217
+
> [!NOTE]
218
+
>
219
+
> `MongoDbGridFSSnapshotStore` is not designed for normal snapshot store plugin, it does not support transaction and read/write operations are slower on this plugin. Only use this plugin if you are having 16 megabyte limit problem.
220
+
221
+
Note that `MongoDbGridFSSnapshotStore` is considered as advanced optional plugin and it will not get an `Akka.Hosting` support. You will need to use HOCON configuration to use this plugin.
222
+
223
+
## Configuring `MongoDbGridFSSnapshotStore`
224
+
225
+
You will need to override the `class` property of the snapshot store `mongodb` HOCON settings to use this plugin. If you're using a custom snapshot-store plugin identifier, then you will need to change that instead. Note that the `use-write-transaction` setting is ignored on this plugin.
0 commit comments