Messaging is a great way to build loosely coupled, scalable, and reliable systems. But it has its challenges. The most common difficulty is seeing what's happening in a system. This is one of the problems solved by the Particular Service Platform.
The goal of the Platform is to provide a set of tools that make it easier to build and maintain messaging systems. The tools are tailored to the common needs of messaging systems and 'just work', out of the box. They enable developers to focus on more important challenges, such as gaining a better understanding of their business domains.
The details of each component are discussed below. A Particular Service Platform-based system consists of several NServiceBus endpoints. Endpoints are logical entities that perform business operations. They communicate with each other using messages (via queues). They also forward messages to ServiceControl for auditing. ServiceControl stores this audit trail and provides integration points for ServicePulse and ServiceInsight. ServicePulse provides monitoring and recoverability for production systems. ServiceInsight provides debugging and visualization into how the system works.
NServiceBus - where it all begins
NServiceBus, the heart of the system, is a messaging and workflow framework. It helps create distributed systems that are scalable, reliable, and easy to change. It supports various messaging patterns, encapsulates long-running business processes as sagas, and provides abstractions over several queuing and storage technologies.
Most queuing technologies try to guarantee 'at least once', or even 'exactly once', message delivery. They usually fall short of this promise. NServiceBus solves intermittent delivery problems by automatically retrying messages using various strategies. If all else fails, it forwards messages to an error queue. From there, ServiceControl and ServicePulse expose the problems for human intervention.
NServiceBus is modular in design and highly extensible. There are many options to choose from for queueing, storage, serialization, logging, and more. Many elements of the system can be replaced with custom implementations for specific scenarios.
ServiceControl - data collection
ServiceControl is a background process that collects useful information about an NServiceBus system. It uses an audit queue to collect every message flowing through the system and an error queue to collect failed messages. It can also collect saga state changes, endpoint heartbeats, and perform custom checks using a control queue. This information is exposed to ServicePulse and ServiceInsight via an HTTP API and SignalR notifications.
ServiceControl can also be configured to collect detailed performance metrics, for display in ServicePulse.
NServiceBus endpoints can be configured to send data about their operations to a set of centralized queues that are unique to the system. A ServiceControl instance monitors these queues, and collects and processes this data. ServiceControl instances are created and managed using the ServiceControl Management Utility.
Note that data is still collected even if the ServiceControl instance is down. When it starts working again, it will process the information that was saved while it was offline.
To enable ServiceControl to gather this information, configure the endpoints appropriately:
- Enable auditing to collect all messages.
- Configure recoverability to collect failed messages.
- Install plugins to monitor endpoint health, collect saga state changes, and use custom checks.
See Optimizing ServiceControl for use in different environments for more information about practical considerations.
ServiceInsight - visualization
ServiceInsight is a desktop application designed for developers. It provides advanced debugging, visualizations of messages flowing through the system, saga state changes, and more.
It's quicker and easier to spot anomalies and incorrect behavior in a system using message flow diagrams, sequence diagrams, and other visualizations provided by ServiceInsight. More detailed information, such as message headers and message metadata, is also shown.
ServicePulse - monitoring
ServicePulse is a web application designed for administrators. It provides a clear, near real-time, high-level overview of how a system is currently functioning. The UI also provides common failure recovery operations, such as retrying failed messages.
ServicePulse also has a rich, graphical view of detailed performance metrics. These are shown at the level of logical endpoints, physical instances, and even individual message types.
ServiceControl and ServicePulse are server applications. They should be deployed in each environment, for example: test, QA, and production. ServiceInsight is a client application. It should be deployed on a workstation and connected to ServiceControl in the appropriate environment.
When investigating problems, or developing custom checks, it can be useful to have the Platform installed on a development machine.