OutboxData table is created in the wrong database server

We are currently looking into enabling the outbox for our applications.

Our system has a dedicated nServiceBus SQL database server, which contains the message queues. Our application endpoints are configured to create queues in this nServiceBus database server and move messages (command,events) there via SQL Server Transport.

.UseCustomConfiguration(endpointConfiguration =>
		var connectionString = "server=NServiceBusServer;Database=NServiceBusDb;";

		var transport = endpointConfiguration.UseTransport<SqlServerTransport>();
		var persistence = endpointConfiguration.UsePersistence<SqlPersistence>();
		var dialect = persistence.SqlDialect<SqlDialect.MsSqlServer>();
		persistence.ConnectionBuilder(connectionBuilder: () => 
			new Microsoft.Data.SqlClient.SqlConnection(connectionString));

		// ... some irrelevant logic regarding the subscription table

		 * Below settings are problematic. OutboxData should be created with another connectionstring
		 * e.g, "server=ApplicationServer;Database=ApplicationDb;"

Our applications have their own application SQL database servers with business data. With Outbox, we expect that the endpoint creates and uses an OutboxData-table in our application database.

However, our endpoints are creating the OutboxData-table in our nServicebus database instead and not in our application database.

We believe we still need to configure an additional connection(string) to tell the endpoint that the OutboxData-table should be used in the application database server and not in the nServiceBus database. Currently, our endpoint only knows the connectionstring to the nServiceBus database. I think it reuses this connectionstring for all database operations, including writing into and polling the Outbox.

Question: Are there any pointers or reference documentation on how to do this?

We already checked the following sources, but this situation doesn’t appear to be covered there:


Hi @DevJ,

The connectionString passed to persistence should be the same as where your business data lives

//the connectionString passed to persistence
// should be the same as where your business data lives 

persistence.ConnectionBuilder(connectionBuilder: () => 
			new Microsoft.Data.SqlClient.SqlConnection(connectionString));

The persistence infrastructure is designed to live next to your business data and should share the same connection string as your business data. Outbox is a part of the Persistence infrastructure.

Also, it is valid to use a separate database for your Sql Transport as it acts as the broker.

Hope this helps.

1 Like