I am only getting started with NServiceBus after having used Rhino ESB for some time. Overall, I’m liking the functionality. However, at least in the 2.5 release, configuration is a little sensitive and often doesn’t provide any useful information when things go wrong. Take, for example, the following configuration for a web application:
NServiceBus.Configure.WithWeb() .XmlSerializer() .Log4Net() .CastleWindsorBuilder() .MsmqTransport() .IsTransactional(false) .PurgeOnStartup(false) .UnicastBus() .ImpersonateSender(false) .CreateBus() .Start();
When you put in this your Application_Start method it throw a null reference exception in the NServiceBus configuration routine. As it turns out, the code was supposed to look like this instead:
NServiceBus.Configure.WithWeb() .Log4Net() .CastleWindsorBuilder() .XmlSerializer() .MsmqTransport() .IsTransactional(false) .PurgeOnStartup(false) .UnicastBus() .ImpersonateSender(false) .CreateBus() .Start();
Did you spot the difference? The issue is you can’t tell it which serializer to use until after you tell it how to configure the container. Seems kind of fragile if you ask me. This certainly doesn’t make NServiceBus a bad library, but it does make it quite a bit harder to get started. Anyway, thanks to this being open source I was able to debug into the offending routine and figure out what was going wrong.