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
MassTransit offers built in background services: InboxCleanupService and BusOutboxDeliveryService.
When using a single database, every message to be sent using the outbox is stored in the database using the same transaction the application uses. This way the messages are not delivered to the broker when an error occurrs, or the transaction is rolled-back manually.
This works fine when using a single database, even with multi-tenancy enabled using a discriminator column in every table.
💣 Enter multi-tenancy with a database-per-tenant. 💣
Different tenants will use different transactions and different databases; or even whole different database systems/servers.
The built-in cleanup and outbox delivery background services can not be used in this use case. We need background services that clean and publish messages for every known tenant, because those services need to access different databases or even different database systems/servers.
The services need to access a tenant database (abstracting this used a provider servcice). The tenant information received must contain everything needed to iterate every tenant (maybe make it horizotally scalable) and eecute the login of the existing background services InboxCleanupService and BusOutboxDeliveryService.
The text was updated successfully, but these errors were encountered:
mgernand
changed the title
Create MassTransit background services for dataper-per-tenant multi-tenant applications.
Create MassTransit background services for database-per-tenant multi-tenant applications.
Jan 17, 2023
MassTransit offers built in background services:
InboxCleanupService
andBusOutboxDeliveryService
.When using a single database, every message to be sent using the outbox is stored in the database using the same transaction the application uses. This way the messages are not delivered to the broker when an error occurrs, or the transaction is rolled-back manually.
This works fine when using a single database, even with multi-tenancy enabled using a discriminator column in every table.
💣 Enter multi-tenancy with a database-per-tenant. 💣
Different tenants will use different transactions and different databases; or even whole different database systems/servers.
The built-in cleanup and outbox delivery background services can not be used in this use case. We need background services that clean and publish messages for every known tenant, because those services need to access different databases or even different database systems/servers.
The services need to access a tenant database (abstracting this used a provider servcice). The tenant information received must contain everything needed to iterate every tenant (maybe make it horizotally scalable) and eecute the login of the existing background services
InboxCleanupService
andBusOutboxDeliveryService
.The text was updated successfully, but these errors were encountered: