NServiceBus.GuardNoActivity 4.0.1

dotnet add package NServiceBus.GuardNoActivity --version 4.0.1
                    
NuGet\Install-Package NServiceBus.GuardNoActivity -Version 4.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NServiceBus.GuardNoActivity" Version="4.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NServiceBus.GuardNoActivity" Version="4.0.1" />
                    
Directory.Packages.props
<PackageReference Include="NServiceBus.GuardNoActivity" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NServiceBus.GuardNoActivity --version 4.0.1
                    
#r "nuget: NServiceBus.GuardNoActivity, 4.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NServiceBus.GuardNoActivity@4.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NServiceBus.GuardNoActivity&version=4.0.1
                    
Install as a Cake Addin
#tool nuget:?package=NServiceBus.GuardNoActivity&version=4.0.1
                    
Install as a Cake Tool

NServiceBus.GuardNoActivity

Raises NServiceBus critical error after a configurable duration of inactivity.

Version compatibility

NServiceBus NServiceBus.GuardNoActivity
v10.x v4.x
v9.x v3.x
v8.x v2.x
v7.x v1.x

Introduction

Message processing can come to a halt for sometimes very hard to detect reasons. Some systems always have a flow of messages. If no message is processed for a while that could be very suspicious and in a lot of systems simply not possible. Maybe there are plenty of message but the processing deadlocked itself.

This package ensures that if no message is received within the configured period that the endpoint will raise an NServiceBus critical error. Most implementations should terminate the endpoint instance or endpoint instance process so that the process host can restart and revive message processing.

Installation

Install the Nuget package NServiceBus.GuardNoActivity

Install-Package NServiceBus.GuardNoActivity

Migrating to NServiceBus 11

In NServiceBus 10.x, this feature is still auto-enabled via assembly scanning. NServiceBus 11 will remove assembly scanning of features, so EnableByDefault() will stop working. To ensure a smooth upgrade, explicitly call RaiseCriticalWhenNoActivity() on your EndpointConfiguration:

endpointConfiguration.RaiseCriticalWhenNoActivity(TimeSpan.FromMinutes(5));

Configuration

Raise a critical error after 5 minutes:

endpointConfiguration.RaiseCriticalWhenNoActivity(TimeSpan.FromMinutes(5));

Demo

Included is a demo project. It uses a 3 second activity window. After starting it waits 10 seconds and you'll get 3 log entries indicating there was no activity.

Output:

2026-02-15 12:40:03.166 INFO  Logging to '…/NServiceBus.GuardNoActivityDemo/bin/Release/net10.0/' with level Info
Received message at 02/15/2026 12:40:03
Received message at 02/15/2026 12:40:05
Received message at 02/15/2026 12:40:07
2026-02-15 12:40:10.405 FATAL No activity for 00:00:03 (limit: 00:00:03), last activity 2026-02-15 12:40:07Z
System.Exception: No activity for 00:00:03 (limit: 00:00:03), last activity 2026-02-15 12:40:07Z
2026-02-15 12:40:13.407 FATAL No activity for 00:00:06 (limit: 00:00:03), last activity 2026-02-15 12:40:07Z
System.Exception: No activity for 00:00:06 (limit: 00:00:03), last activity 2026-02-15 12:40:07Z
2026-02-15 12:40:16.408 FATAL No activity for 00:00:09 (limit: 00:00:03), last activity 2026-02-15 12:40:07Z
System.Exception: No activity for 00:00:09 (limit: 00:00:03), last activity 2026-02-15 12:40:07Z
2026-02-15 12:40:19.402 INFO  Initiating shutdown.
2026-02-15 12:40:19.410 INFO  Shutdown complete.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.1 0 2/15/2026
4.0.0 0 2/15/2026
3.0.0 258 6/14/2024
2.0.0 11,030 12/9/2022
1.0.0 20,346 5/11/2021