1

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?

Rebecca
  • 13,914
  • 10
  • 95
  • 136
  • Doesn't support message headers? Where do you get that from? – Damien_The_Unbeliever Oct 13 '14 at 12:55
  • @Damien_The_Unbeliever updated my answer. It appears I might have been confused by the "bus does not implement IManageMessageHeaders". – Rebecca Oct 13 '14 at 13:14
  • I'm not familiar with `IManageMessageHeaders` and nor is Google, apparently. And, for reference, I've just opened a random message from our audit table and looked at the headers - it has 25, of which 5 are our custom headers that we apply in our messaging system - so I'm fairly certain that message headers are supported on SQL Server. – Damien_The_Unbeliever Oct 13 '14 at 13:25
  • Here is where that is called: https://github.com/Particular/NServiceBus/blob/def31db15977a6017737f134c15d1698edff97e0/src/NServiceBus.Core/ExtensionMethods.cs – Rebecca Oct 13 '14 at 13:29
  • IManageMessageHeaders interface is here: https://github.com/Particular/NServiceBus/blob/def31db15977a6017737f134c15d1698edff97e0/src/NServiceBus.Core/IManageMessageHeaders.cs – Rebecca Oct 13 '14 at 13:29
  • Thanks @Damien_The_Unbeliever. https://github.com/Particular/NServiceBus.SqlServer.Samples agrees with you! – Rebecca Oct 13 '14 at 13:30
  • Looks like that interface is new for version 5, so far as I can see. Not sure if the SQL transport has been updated for that. – Damien_The_Unbeliever Oct 13 '14 at 13:37
  • @Damien_The_Unbeliever quite possibly then it was a red-herring. – Rebecca Oct 13 '14 at 14:20
  • I'm having the same problem and I'm not using SQLServerTransport. I'm trying to get another sample to work and the error happens on MVC front end in a controller on the following line: Bus.SetMessageHeader(order, "access_token", HttpContext.Current.Request.Params["access_token"]); – sasharz Oct 14 '14 at 18:49
  • Check if your Bus object has something in it. I realized my Bus object was null and the message was misleading. – sasharz Oct 14 '14 at 19:27
  • Same DB is for both transport and persistence is supported. What was the issue you had with that setup? – Andreas Öhlund Oct 14 '14 at 20:10

1 Answers1

1

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)

Szymon Pobiega
  • 3,358
  • 17
  • 18