What is NServiceBus?

March 07, 2024#Software Development
Series: NServiceBus
Article
Author image.

Kyle McMaster, Senior Consultant

This post is the beginning of a series focused on NServiceBus which aims to provide an overview of the framework and its ecosystem. We’ll start this series with the basics by providing tips for getting started to get you quickly up and running and then dive into some of the more advanced features and use cases. For the series, sample code and examples based on the Ardalis Clean Architecture template will be used to demonstrate any technical concepts covered so that the reader can step through and grasp the concepts at a code level whenever needed. In this article, we will look at some of the different components of NServiceBus and tooling in the ecosystem that can improve your experience building and maintaining distributed systems.

What is NServiceBus? 📨

NServiceBus is a framework packed full of features for implementing messaging and workflow orchestration in .NET applications. NServiceBus at its core is a messaging framework that helps you to send and receive messages between different components of your applications. These components can be distributed on different servers in different environments. NServiceBus is built with architectural best practices in mind and it follows many of the Enterprise Integration Patterns. It provides a high-level API for working with messaging patterns such as publish/subscribe, request/response, and message routing. Its features make development easier for implementing more advanced messaging patterns including sagas, outboxes, and the unit of work pattern. You can read more about NServiceBus here.

NServiceBus is the foundational component of the Particular Service Platform, a set of tools that simplify the development, monitoring, and operation of message-based applications. While NServiceBus on its own serves as a great library for developing applications, this additional set of tools includes ServiceControl, ServiceInsight, and ServicePulse are huge value add for teams building and maintaining distributed systems. Often, a lot of time upfront is spent designing solutions to handle business logic when developing messaged-based applications but the operation and maintenance of these systems can be an afterthought. Modifying these systems for new requirements or troubleshooting issues can be difficult and time-consuming, especially in a distributed system. The Particular Service Platform aims to make these tasks easier and more efficient by providing tools to solve common problems like retrying messages, visualizing distributed message flows, and analyzing performance metrics for individual messages. Below is a simplified diagram of the Particular Service Platform architecture.

Simplified Diagram of the Particular Service Platform

What is ServiceControl? 🚦

ServiceControl is a tool that collects and stores information about the NServiceBus messages being processed in a given system that enables ServicePulse and ServiceInsight to provide real-time monitoring and visualization. A ServiceControl instance has 3 types, error, audit, and monitoring which run as a background process. It then provides an API for viewing and analyzing this information. It can be configured to collect performance metrics and detect state changes in NServiceBus sagas. It can also perform custom checks (like pushing data to Azure Application Insights) that may be needed for your specific application or deployment scenario. You can read more about ServiceControl here.

What is ServiceInsight? 🕵️

ServiceInsight provides a visual representation of the messages flowing through your system. It allows you to visualize the behavior of messages between different endpoints in your system via flow diagrams and sequence diagrams, similar to telemetry and analytics you may have used in distributed tracing. These visualizations can help understand how your system is behaving and for troubleshooting issues. ServiceInsight also provides the ability to inspect the contents of individual messages, view the state of sagas, and monitor message performance metrics. You can read more about ServiceInsight here.

What is ServicePulse? 💓

ServicePulse is a monitoring tool that provides high-level information on the health of your NServiceBus system. Its web-based dashboard provides a real-time view of the status of your endpoints, failed messages, and custom checks you may have configured in ServiceControl. It also provides a way to manage failed messages and retry them. If it is configured alongside a ServiceControl monitoring instance, it can display detailed information and performance metrics about the messages being processed in your system. You can read more about ServicePulse here.

Summary 📝

In this article, we looked at NServiceBus and the Particular Service Platform and highlighted the key features of these tools. In the next article in this series, we will look at how to get started with NServiceBus in .NET 8. As we progress through the series, we will dive deeper into the features of NServiceBus and the Particular Service Platform and how they can be used to build and maintain distributed systems.

Resources 📚

NServiceBus The Particular Service Platform


Copyright © 2024 NimblePros - All Rights Reserved