NServiceBus.GuardNoActivity 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package NServiceBus.GuardNoActivity --version 2.0.0                
NuGet\Install-Package NServiceBus.GuardNoActivity -Version 2.0.0                
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="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NServiceBus.GuardNoActivity --version 2.0.0                
#r "nuget: NServiceBus.GuardNoActivity, 2.0.0"                
#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.
// Install NServiceBus.GuardNoActivity as a Cake Addin
#addin nuget:?package=NServiceBus.GuardNoActivity&version=2.0.0

// Install NServiceBus.GuardNoActivity as a Cake Tool
#tool nuget:?package=NServiceBus.GuardNoActivity&version=2.0.0                

NServiceBus.GuardNoActivity

Raises NServiceBus critical error after a configurable duration of inactivity.

Version compatibility

NServiceBus NServiceBus.GuardNoActivity
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

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:

2022-12-09 17:23:07.844 INFO  Logging to 'S:\NServiceBus.GuardNoActivity\src\NServiceBus.GuardNoActivityDemo\bin\Debug\net6.0\' with level Info
2022-12-09 17:23:07.933 INFO  Selected active license from C:\ProgramData\ParticularSoftware\license.xml
License Expiration: 2023-01-01
2022-12-09 17:23:11.024 FATAL No activity for 00:00:03, last activity 9-12-2022 16:23:08
System.Exception: No activity for 00:00:03, last activity 9-12-2022 16:23:08
2022-12-09 17:23:14.034 FATAL No activity for 00:00:03, last activity 9-12-2022 16:23:08
System.Exception: No activity for 00:00:03, last activity 9-12-2022 16:23:08
2022-12-09 17:23:17.048 FATAL No activity for 00:00:03, last activity 9-12-2022 16:23:08
System.Exception: No activity for 00:00:03, last activity 9-12-2022 16:23:08
2022-12-09 17:23:18.040 INFO  Initiating shutdown.
2022-12-09 17:23:18.045 INFO  Shutdown complete.
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Framework net472 is compatible.  net48 was computed.  net481 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
3.0.0 102 6/14/2024
2.0.0 315 12/9/2022
1.0.0 14,894 5/11/2021