NServiceBus Visual Studio Modeling Tools

NServiceBus Rescue Me It has been sometime since I worked with NServiceBus, in fact, since version 1.9.3. Yesterday that changed. A request to analyze and evaluate an application with the goal to improve notification services came my way. A little about the application; it provides email notification based on certain business rules to a subscriber base, external interfaces and new users. Currently the system is not consistently sending notifications in a timely mannaer, has dependencies on deprecated technology and services are marginal at best. The application must support high volume of notifications, reply in a timely manner, and in some cases be guarenteed. The solution should be flexible enough to support SOA and Event Driven architectures and in the near future provide the services mentioined to external systems with ease.

After hearing the pain points of the existing solution, reviewing the current solution and our application interactions, and learning more about the near future requirements I immediately thought NServiceBus. However, before designing a solution around NServiceBus I must become reaquanted with the technology as many things have changed between 1.9.3 and 3.0 versions. The concepts and overall architecure has not changed much but the functionality, support, out of box features, and convention over configuration changed. The first few things I noticed after downloading NServiceBus 3.0 from the site; Visual Studio Modeling support, NuGet package support and movement to convention over configuration. The remainder of the blog discusses my evaluation of NServiceBus Modeling Tools for Visual Studio 2010.

Modeling Tools for Visual Studio

  1. Modeling Design Canvas
  2. Code Generation
  3. Default Configuration
  4. Updating the Model

Time to dive into each point.

The brains behind NServiceBus is Udi Dahan, a thought leader in SOA and DDD, and founder of NServiceBus. Udi announced NServiceBus Modeling Visual Studio Support about five months ago. I recommend talking a look at the 25 minute video to get up to speed and a nice walk-through of the new tooling. I also suggest reviewing the sample applications and reviewing the FAQ.

Modeling Design Canvas

The modeling canvas is nice, supporting drag and drop from the Toolbox. Connecting Commands, Endpoints and Events is accomplished simply by dragging Emit or Process arrows. In addition, you can set object properties for each in using Properties View. At times, I did find myself making process connections using the Properties View instead of the drag and drop feature. The canvas supports moving around objects easily to ensure the diagram is clear and easily understandable. Listed below is the toolbox objects available. I would like to see a bit of color in the diagram.


  • Command
  • Emit
  • Event
  • Process
  • Send-only endpoint
  • Send/receive endpoint

Designer View: ( The text does not appear in the model, was added to the image seen below. ) NServiceBus Designer Canvas Example

Code Generation

The designer supports a one time code generation. At this time the designer does not permit regenerating the code after changing the diagram. Udi is upfront with this in his video, basically the team is working on support for this but will take sometime. Honestly, five months later I would have expected to see a beta release with regeneration support ( maybe I’m off base ). In the interim, initial code generation is fine, but for this modeling to be really useful and powerful it must support regeneration. In addition, I’d like to see Generate Code menu item when right clicking on the design canvas. The initial code generation for configuring a web client should be updated to support auto creation of queues ( talk more about in a few ).

After generating the code, all the references added to support the NServiceBus projects were broken. To resolve them I actually leveraged NuGet to install the NServiceBus package. Of note, Adam Fyles indicated in his review there was an issue with a few MSBuild variables causing the issue. I appreciate NServiceBus providing a NuGet package, to complete that support I’d recommend wrapping the example projects for download into an NServiceBus.Sample NuGet package.

Default Configuration

I hit a small road block for a bit with the initial configuration of the web application regarding the convention not automatically creating the queues. Creating the queues resolved a most of the issue. After reading a bit about 3.0 no longer creating the queues by default and having to define the endpoint name things worked fine. To enable auto creation of the queues add this line to the Configure.WithWeb() convention setup for ASP.NET Web Forms or MVC. In addition, I recommend reading the following regarding endpoint naming.

.Start(() => Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install());

Updating the Model

Again, there is no support for code generation after updating the model in the designer. I see the value for initial prototyping and learning but the standard in Visual Studio is altering the model or the code syncs in either direction.