Monday, August 9, 2010

NServiceBus - What did I just download?

I'm currently working on getting some teams in my organization On the Bus and I find myself often quickly explaining what you get when you download NSB.  It includes so much functionality that it helps to quickly dissect what is there.  I'm going to lay it out at a high level so we all know what's in there and where to go first.

Root Directory
The top level directory is pretty self explanatory, I'm going to jump right into the first level of directories and start the tour there.

Binaries

This directory contains the bare bones to run NSB.  The exe is the Generic Host provided with NSB.  This gives us a process to run NSB inside of.  The only other assemblies you really need to run basic NSB functionality is NServiceBus.Core, NServiceBus, and log4net.  The rest will depend on your use case.  The "containers" directory has the binaries for the container of your choice, you don't have to use the default container(Spring).  The "x64" directory has the x64 version of SQLite for testing purposes.

Docs

The "docs" directory has some slides and diagrams of some of the functionality included with NSB, more on these later.  It also has some common code snippets for Visual Studio.  Don't expect deep dive information in the slides, they are just pictures at this point.

Processes
The "processes" directory contains some NSB infrastructure that you'll need for certain NSB use cases.  
  • "distributor" - contains the background process for distributing load across many instances of NSB.  This process handles monitoring the work load and distributing the work to worker nodes.
  • "gateway" - contains the process that manages moving messages between disparate instances of NSB. This is especially useful if you have more that one data center.  You can move messages between sites using the gateway.
  • "proxy" - this process allows us to expose a single endpoint to several clients.  This is handy when you need to expose NSB through a firewall.
  • "timeout" - this process handles the watching of the clock for Sagas.  Sagas are analogous to long running workflows.  When using Sagas, you need something to keep a watch and wait up workflows when necessary.
Samples

  • "AsyncPages" - example of how to due asynchronous request/response on a web page using ASP.NET as your host process. 
  • "FullDuplex" - example of performing request/response in a non-web scenario
  • "GenericHost" - example of how the host provided with NSB works.  Via the concept of profiles we can manipulate the behaviour of the host.
  • "Manufacturing" - this example has a lot of stuff in it, including Pub/Sub, Sagas, interop with straight MSMQ, the included testing framework, message ordering, and more.  I found myself taking bits of this example and breaking it down into smaller examples.
  • "PubSub" - basic example of how to implement the Publish/Subscribe pattern in NSB.
  • "Versioning" - shows how that through interfaces, NSB allows us to gracefully version messages to consumers without breaking them.
  • "WcfIntegration" - shows off the OOTB support for exposing NSB as a HTTP/WCF service.  This becomes useful if you have to interact with another non-MSMQ system.
  • "WebServiceBridge" - hosts NSB from within ASP.NET again, only this time in a web service.  The web site in this sample using the service to bridge into NSB without knowing about NSB itself.
Tools
  • "MsmqUtils" - provides a program for you to run to validate your install of MSMQ and MSDTC.  This is a handy tool to make sure you start off on the right foot, I recommend running this right after you download NSB to avoid headaches.
  • "ReturnToSourceQueue.exe" - takes messages from a queue(typically an error queue) and pushes them back to the source queue.  This tool is very effective when you have a bunch of failures that you want to re-process.  I would make sure your SysAdmins know about this tool.
  • "UI.exe" - is a limited UI for managing NSB endpoints.
  • "XsdGenerator.exe" - this tool will generate an XSD file using an assembly of messages as input.  This is for the case where you don't want to directly distribute your messages assembly, but would rather have consumers build their own.

That pretty much covers it, there is a lot of stuff in here!  I'm hoping to next start talking about some of the use cases we've had to leverage NSB and get started on a demo project to walk through an application of NSB.




No comments:

Post a Comment