Currently, we have adopted an axon framework for an event-based application with MongoDB as the database in the SaaS application. We have adopted the approach of adding the field tenantId to all the events created.
For legal reasons, I have to make the application multitenant(SaaS) with a database per tenant. Before Proceeding with technical discussion will provide details about the versions we are using:
axon-framework - 4.4
axon-mongo - 4.4
We are also using other microservices running on spring-boot and MongoDB wherein, we are able to achieve the same by overriding few classes of MongoDB.
Now we are trying the similar approach with axon-mongo, but we are not able to find any appropriate help where we can change the DB at runtime based on Tenant.
It would be great if you can assist how we can achieve this. Also, any code example would be helpful. If this is not possible what are other alternatives?