Femur.Messaging.ServiceBus 0.0.31

dotnet add package Femur.Messaging.ServiceBus --version 0.0.31
                    
NuGet\Install-Package Femur.Messaging.ServiceBus -Version 0.0.31
                    
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="Femur.Messaging.ServiceBus" Version="0.0.31" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Femur.Messaging.ServiceBus" Version="0.0.31" />
                    
Directory.Packages.props
<PackageReference Include="Femur.Messaging.ServiceBus" />
                    
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 Femur.Messaging.ServiceBus --version 0.0.31
                    
#r "nuget: Femur.Messaging.ServiceBus, 0.0.31"
                    
#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 Femur.Messaging.ServiceBus@0.0.31
                    
#: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=Femur.Messaging.ServiceBus&version=0.0.31
                    
Install as a Cake Addin
#tool nuget:?package=Femur.Messaging.ServiceBus&version=0.0.31
                    
Install as a Cake Tool

Femur.Messaging.ServiceBus

Azure Service Bus transport implementation for Femur.Messaging.

Installation

dotnet add package Femur.Messaging.ServiceBus

Usage

Configuration

Configure Azure Service Bus in your appsettings.json:

{
  "ConnectionStrings": {
    "ServiceBus": "Endpoint=sb://your-namespace.servicebus.windows.net/;SharedAccessKeyName=..."
  },
  "ServiceBus": {
    "QueueName": "orders"
  }
}

Registration

Recommended: Using IConfiguration (DI Resolution Time)

This approach lets dependency injection resolve your configuration, supporting IOptions, named options, and configuration reloading:

var builder = Host.CreateApplicationBuilder(args);

// Register message handler and processor
builder.Services.AddMessageHandler<OrderMessage, OrderMessageHandler>()
    .UseTransport() // Use default transport
    .Configure(options =>
    {
        options.MaxConcurrentMessages = 5;
        options.MaxRetries = 3;
    });

// Add Service Bus transport - connection string resolved from IConfiguration at runtime
builder.Services.AddFemurServiceBus(
    sp => sp.GetRequiredService<IConfiguration>().GetConnectionString("ServiceBus")!,
    configure: options => options.QueueName = builder.Configuration["ServiceBus:QueueName"]!);

var host = builder.Build();
await host.RunAsync();

Using IOptions Pattern

// Configure options
builder.Services.Configure<ServiceBusConfig>(builder.Configuration.GetSection("ServiceBus"));

// Add Service Bus with options resolution
builder.Services.AddMessageHandler<OrderMessage, OrderMessageHandler>();

builder.Services.AddFemurServiceBus(
    sp => sp.GetRequiredService<IOptions<ServiceBusConfig>>().Value.ConnectionString,
    configure: options =>
    {
        var config = builder.Configuration.GetSection("ServiceBus").Get<ServiceBusConfig>();
        options.QueueName = config!.QueueName;
    });

Direct Connection String (Simple Cases)

// For simple scenarios where configuration is static
builder.Services.AddMessageHandler<OrderMessage, OrderMessageHandler>();
builder.Services.AddFemurServiceBus(
    "Endpoint=sb://your-namespace.servicebus.windows.net/;...",
    configure: options => options.QueueName = "orders");

Authentication

The Service Bus transport uses DefaultAzureCredential for authentication, which supports:

  • Managed Identity (in Azure)
  • Azure CLI credentials (local development)
  • Environment variables
  • Visual Studio/VS Code credentials

For local development, ensure you're logged in with Azure CLI:

az login

Configuration Options

public class ServiceBusOptions
{
    public string FullyQualifiedNamespace { get; set; } = string.Empty;
    public string QueueName { get; set; } = string.Empty;
}

Features

  • Automatic message settlement (complete/abandon/dead-letter)
  • Session support
  • Dead-letter queue handling
  • Retry policies
  • Managed Identity authentication

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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
0.0.31 132 3/30/2026