NServiceBus Step-by-step

The best way to get started with NServiceBus is to use it to build something realistic. In doing so, you'll learn the architectural concepts behind the software and start to learn its capabilities. In this tutorial, you'll build a back-end for a retail e-commerce system. You'll learn how to send asynchronous messages between processes, how to use the publish/subscribe pattern to decouple business processes, and the advantages of using reliable messaging to enable automatic retries after processing failures.

The tutorial is divided into five lessons, each of which can be accomplished in a half hour or less — perfect for your lunch break.

  • Part 1: Getting started (10-15 minutes) - Set up your development environment and create your very first messaging endpoint.

  • Part 2: Sending a command (15-20 minutes) - Define messages and message handlers, and send your first message.

  • Part 3: Multiple endpoints (15-20 minutes) - Create multiple endpoints and send messages between them.

  • Part 4: Publishing events (25-30 minutes) - Learn about the publish/subscribe pattern, how to publish events to multiple subscribers, and about the benefits of using this pattern to decouple business processes.

  • Part 5: Retrying errors (25-30 minutes) - Use the Particular Service Platform tools to gracefully recover from exceptions in your code, allowing you to build systems that are resistant to failure.

When you've completed all the exercises, your solution will look like this:

Completed Solution Diagram