That's ok for me.
Regarding read / query side, my opinion on that is that if you configured your write side as multi-tenant, then the read side should behave the same.
In fact if the application wants to merge differents streams from different tenant, it can be quite easily done with akka streams.
Note that the opposite could be done as well (ie. all events then app filters the events) but, for me, it looks way more dangerous because tenant are mixed by default ...,
and from performance point of view, I think the first one is better as well.
But I have to admit that I don't really know how to handle the tenant from the interfaces provided by Akka.
Those interfaces are bounded to a plugin identifier, and then provides methos which does not have any tenancy stuff.
I will have to deep into the code to see what are the solutions. do you have idea ?
ScalaDslMongoReadJournal
to set the database, if it was not given the configuration (ie. database-resolver was given)
Hi @nleso -
It is not documented in the latest documentation, but there is a legacy approach to supply connection information to the plugin that can be seen in the older documentation. The implementation is in MongoSettings.MongoUri:
val MongoUri: String = Try(config.getString("mongouri")).toOption match {
case Some(uri) => uri
case None => // Use legacy approach
val Urls = config.getStringList("urls").asScala.toList.mkString(",")
val Username = Try(config.getString("username")).toOption
val Password = Try(config.getString("password")).toOption
val DbName = config.getString("db")
(for {
user <- Username
password <- Password
} yield {
s"mongodb://$user:$password@$Urls/$DbName"
}) getOrElse s"mongodb://$Urls/$DbName"
}
You can see if the mongouri
configuration is not supplied, it falls back to using the legacy fields of urls
, username
, password
, db
... which now that I've typed all this out I see just generates a URI. Hmm
Hi @alokshukla121:matrix.org -
There's no configuration to turn on. But it looks like there may be a configuration setting to turn off.
Looking at: https://github.com/scullxbones/akka-persistence-mongo/blob/master/common/src/main/scala/akka/contrib/persistence/mongodb/MongoDataModel.scala I see your type
is considered to be Legacy
. Do you have legacy serialization enabled? That may play havoc with tagging.
RecoveryFailed
. Logging is done via slf4j, but it is fairly limited, preferring instead to communicate failures through akka's plugin interface, e.g. Try[Unit]
realtime-enable-persistence
- is enabled by default ... https://github.com/scullxbones/akka-persistence-mongo/blob/master/common/src/main/resources/reference.conf#L34
Hi @jsarrelli - the plugin respects the calls that are made from the library. If multiple messages are passed via asyncWriteMessages
then they are stored as a batch in a single document in mongodb. This is because the unit of atomicity for mongodb is the document
This should be triggered by this documented usage or if you prefer classic