How to configure different persistence's for saga and outbox

We are already using Azure CosmosDb for our Saga persistence, but our primary business data store is SQL Server.

We now have a requirement for Outbox pattern, can nservicebus support one persistence store of Sagas and another persistence for outbox ?

a sample configuration would really be helpful.

Thanks -nen

Hi @Nen_Zax

The Outbox is designed to achieve “exactly once”-like behavior similar to distributed transactions, without using distributed transactions. For this to work, all storage operations (outbox, sagas, and business data) need to use the same database. Therefore, it doesn’t really make sense to use different storages when planning to use the outbox.

We have some more in-depth documentation about the outbox here: Outbox • NServiceBus • Particular Docs

Hi @Tim, Thank you for the info. We are in the same place @Nen_Zax was at, with Sagas in Cosmos, but business data in SQL Server (Azure SQL Managed Instances). Is there any documentation available on how we would migrate live production services from using Cosmos persistence to SQL persistence? We can tolerate about 3 min of downtime before some serious issues start occurring, but no downtime is preferred. :slight_smile:

Hi @BBrandtTX

I haven’t looked in details into it but you might be able to use

Or leverage change feeds Working with the change feed - Azure Cosmos DB | Microsoft Learn

I’m guessing Data Factory or now Microsoft Fabric allows doing similar things

https://cosmosdb.github.io/labs/dotnet/labs/02-load_data_with_adf.html

Regards,
Daniel

1 Like

@danielmarbach Would it be feasible to configure both SQL and Cosmos persistence with SQL as the primary saga configuration and then have a fallback to locate the saga in Cosmos if it is not found in SQL?

Any idea why this detailed example of gradually migrating from NHibernate to SQL persistence was removed? I was hoping to follow this guidance in our Cosmos to SQL migration:
docs.particular.net/samples/saga/migration/sample.md at 63ab2793277e030cd2f9cb92b0b64d0b2f345ef0 · Particular/docs.particular.net (github.com)

Removed by this PR:
Remove saga migration sample by lailabougria · Pull Request #6409 · Particular/docs.particular.net (github.com)
(From @laila.bougria and approved by @andreasohlund)

Hi @BBrandtTX

Any idea why this detailed example of gradually migrating from NHibernate to SQL persistence was removed?

As part of review of the sample that occurred when we upgraded to .NET 8, we found the sample to be quite complex, based on broken assumption, and, without further guidance, a risk to our customers. We think we have to rethink that sample and the migration strategies documentation in general.

Would it be feasible to configure both SQL and Cosmos persistence with SQL as the primary saga configuration and then have a fallback to locate the saga in Cosmos if it is not found in SQL?

I don’t think that would be possible out of the box today since there can only be one persister for a specific persistence type be registered.

Regards,
Daniel