NServiceBus.Compression 1.0.0

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

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


Adds message body compression to the NSericeBus pipeline.

Version compatibility

NServiceBus NServiceBus.Compression
v5.x v1.x

Please note that there might be versions targeting other NServiceBus versions. Please check the Releases for all versions. or check the root of the master branch of the repository.


This package is based on the mutator example from the NServiceBus documentation website but is has these additional features:

  • Drop in auto enable compresssion, no need to recompile! Can be saviour is affected by production incidents due to too large messages.
  • Requires messages to be of a minimal size but this thresshold is configurable.
  • Compression level can be configured to have more flexibility between CPU cycles and message size.


The default are:

  • Size treshold: 1000 bytes
  • Compression level: Fastest

This is to not spend CPU cycles on messages that are small. Compression not only costs CPU cycles but also introduces latency both during outgoing and incoming messages.

The following only compresses message over 16KB in size and uses the highest compression level.

busConfiguration.CompressMessageBody(System.IO.Compression.CompressionLevel.Optimal, 16 * 1024);
Product Compatible and additional computed target framework versions.
.NET Framework net452 is compatible.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.5.2

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
5.0.1 68 6/14/2024
4.0.0 2,913 12/9/2022
3.0.0 4,952 5/26/2020
2.0.0 1,066 5/26/2020
1.0.0 549 5/26/2020