Search code examples
nservicebusnservicebus4

What are the limitations of Sql Server Transport in NServiceBus?


I'm trying to get the VideoStore.NHibernate NServiceBus sample (from Github) working using SqlServerTransport rather than MSMQ (we don't want to have any reliance on MSMQ nor RavenDb).

I have switched this sample over to use SqlServerTransport rather than MsmqTransport by doing the following:

  • Adding the appropriate NuGet package for NserviceBus.SqlServer
  • Adding the appropriate connection strings to each app/web.config

When I run the sample with these new settings I notice that the NServiceBus.ExtensionMethods static class has a method called SetMessageHeader that throws an InvalidOperationException when I switch to SqlServerTransport:

public static void SetMessageHeader(this ISendOnlyBus bus, object msg, string key, string value)
{
    IManageMessageHeaders manageMessageHeaders = bus as IManageMessageHeaders;
    if (manageMessageHeaders == null)
        throw new InvalidOperationException("bus does not implement IManageMessageHeaders");
    manageMessageHeaders.SetHeaderAction(msg, key, value);
}

Does that mean that SqlServerTransport doesn't support message headers?

Is there anything else that isn't supported by SQL Server Transport that is pertinent to our decision?

Is there a feature / transport matrix available?

Update:

Ok, maybe I've jumped the gun here. https://github.com/Particular/NServiceBus.SqlServer.Samples seems to suggest that SqlServerTransport does support message headers and Sagas.

Update II

It appears that you the use of the same database for both persistence (NHibernatePeristence) and transport (SqlServerTransport) causes problems. Using separate databases for each role appears to have resolved the problem.

I'd still like to know if there are any drawbacks to using SqlServerTransport though in terms of feature support?


Solution

  • There is not feature degradation when using SQLServer transport compared to MSMQ. Integration with NHibenrnate persistence works fine but requires "DistributedTransactions" enabled (default). Note that if both transport and persitence connection strings are the same, it will actually not escalate to DTC (no performance hit)