Soenneker.ServiceBus.Message 11.0.3230

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.ServiceBus.Message --version 11.0.3230
                    
NuGet\Install-Package Soenneker.ServiceBus.Message -Version 11.0.3230
                    
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="Soenneker.ServiceBus.Message" Version="11.0.3230" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.ServiceBus.Message" Version="11.0.3230" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.ServiceBus.Message" />
                    
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 Soenneker.ServiceBus.Message --version 11.0.3230
                    
#r "nuget: Soenneker.ServiceBus.Message, 11.0.3230"
                    
#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 Soenneker.ServiceBus.Message@11.0.3230
                    
#: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=Soenneker.ServiceBus.Message&version=11.0.3230
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.ServiceBus.Message&version=11.0.3230
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.ServiceBus.Message

Builds Azure ServiceBusMessage instances from Soenneker.Messages.Base.Message payloads with serializer selection, type metadata, size rejection, and optional payload logging.

Installation

dotnet add package Soenneker.ServiceBus.Message

Registration

using Soenneker.ServiceBus.Message.Registrars;

services.AddServiceBusMessageUtilAsSingleton();

The utility is stateless after configuration is loaded. A scoped registration is also available through AddServiceBusMessageUtilAsScoped().

Build and send a message

Define a transport payload derived from Soenneker.Messages.Base.Message, then pass its stable type identifier to BuildMessage:

using Azure.Messaging.ServiceBus;
using Soenneker.Messages.Base;
using Soenneker.ServiceBus.Message.Abstract;

public sealed class OrderCreated : Message
{
    public required string OrderId { get; init; }
}

OrderCreated payload = new()
{
    Type = "order.created.v1",
    Id = Guid.NewGuid().ToString("N"),
    Queue = "orders",
    Sender = "checkout-api",
    CreatedAt = DateTimeOffset.UtcNow,
    OrderId = orderId
};

ServiceBusMessage? transportMessage =
    messageUtil.BuildMessage(payload, payload.Type);

if (transportMessage is null)
    return;

await sender.SendMessageAsync(transportMessage, cancellationToken);

The type argument is placed in ApplicationProperties["type"]. It is independent of payload.Type, so pass the same stable value unless your routing contract deliberately requires something else.

This builder does not map payload.Id to ServiceBusMessage.MessageId, set ContentType, choose a queue, or send the message. Set additional broker properties on the returned message before sending when required.

Serialization and size behavior

Messages are serialized using System.Text.Json.

Messages whose serialized body exceeds 260,096 bytes are rejected and return null. That check covers the body only; it does not calculate the broker size of application properties or other AMQP overhead.

Serialization failures are logged at critical level and return null. Always check the result before passing it to a sender.

Payload logging

Azure:ServiceBus:Log controls payload logging:

{
  "Azure": {
    "ServiceBus": {
      "Log": false
    }
  }
}

When enabled, complete serialized payloads are written at debug level during normal message construction and may be included in critical error logs. It also selects the pretty JSON option instead of the web JSON option, so enabling it changes whitespace in the serialized body.

Leave payload logging disabled for messages containing credentials, personal data, or other sensitive fields unless the log destination and retention policy are appropriate.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Soenneker.ServiceBus.Message:

Package Downloads
Soenneker.ServiceBus.Transmitter

A utility library for sending Service Bus messages

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.3236 75 11/19/2026
11.0.3235 84 11/19/2026
11.0.3234 41 11/19/2026
11.0.3233 85 11/19/2026
11.0.3231 125 11/18/2026
11.0.3230 56 11/18/2026
11.0.3229 333 11/15/2026
11.0.3228 344 11/14/2026
11.0.3226 448 11/11/2026
11.0.3225 283 11/11/2026
11.0.3224 233 11/11/2026
11.0.3223 186 11/11/2026
11.0.3222 93 11/11/2026
11.0.3221 91 11/11/2026
11.0.3219 89 11/11/2026
11.0.3218 428 11/10/2026
11.0.3217 145 11/10/2026
11.0.3216 578 11/3/2026
11.0.3215 173 11/3/2026
11.0.3214 228 11/3/2026
Loading failed

Configure .NET CI defaults and daily source scans