SolTechnology.Core.MessageBus 1.0.0

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

Overview

The SolTechnology.Core.MessageBus library provides minimal functionality needed for Azure Service Bus connection. It handles needed services registration and configuration.

Registration

For installing the library, reference SolTechnology.Core.MessageBus nuget package and invoke AddMessageBus() service collection extension method:

services.AddMessageBus();

Configuration

  1. The first option is to create an appsettings.json section:
  "Configuration": {
    "MessageBus": {
      "ConnectionString": "your-service-bus-connection-string"
    }
  }
  1. Alternatevely the same settings can be provided by optional parameter during registration:
var messageBusConfiguration = new MessageBusConfiguration
{
    ConnectionString = "your-service-bus-connection-string"
};
services.AddMessageBus(messageBusConfiguration);

Usage

II. Message publishing
  1. Register message publisher
            services.AddMessageBus()
                    .WithPublisher<PlayerMatchesSynchronizedEvent>("synchronizeplayermatches");

Where T is a published message type and argument is a topic name.

  1. Inject IMessagePublisher
  public SynchronizePlayerMatchesHandler(IMessagePublisher messagePublisher)
        {
            _messagePublisher = messagePublisher;
        }
  1. Invoke Publish() method
var message = new PlayerMatchesSynchronizedEvent(command.PlayerId);
await _messagePublisher.Publish(message);
I. Message receiving
  1. Register message receiver
builder.Services.AddMessageBus()
                .WithReceiver<PlayerMatchesSynchronizedEvent, CalculatePlayerStatistics>("synchronizeplayermatches", "calculatestatistics");

Where generic arguments are MessageType, MessageHandlerType class and arguments: topicName and subscriptionName.

  1. Make your Message Handler implement IMessageHandler<T> (where T is a MessageType)
public class CalculatePlayerStatistics : IMessageHandler<PlayerMatchesSynchronizedEvent>
  1. Implement Handle(T) method
        public async Task Handle(PlayerMatchesSynchronizedEvent message, CancellationToken cancellationToken)
        {
            var command = new CalculatePlayerStatisticsCommand(message.PlayerId);
            await _handler.Handle(command);
        }
  1. What is more
  • The Message Handler is registered as IHostedService
  • Topics and subsriptions are created from code on registration using default values
  • Message has to implement IMessage inteface

Testing

For integration/component tests, reference the SolTechnology.Core.ServiceBus.Testing companion package. It spins up the official Azure Service Bus emulator via Testcontainers and hands back a connection string you can override MessageBus:ConnectionString with — no cloud namespace required.

Health check

builder.Services.AddHealthChecks()
    .AddServiceBusHealthCheck();        // peeks the first configured queue (non-destructive)

Requires ServiceBusClient + MessageBusConfiguration in DI (registered by AddMessageBus(...)).

Outcome Status
Peek succeeds (broker reachable + Listen claim) Healthy
Broker answers but rejects the probe (UnauthorizedAccessException / MessagingEntityNotFound) Degraded — connectivity is proven, the probe just lacks the claim/entity
No queue configured to probe Degraded — connectivity cannot be verified
Connection / DNS / timeout failure Unhealthy (configurable via failureStatus)
Caller-cancellation Rethrows (not Unhealthy)

The probe uses ServiceBusReceiver.PeekMessageAsync (not CreateSender, which is lazy and never opens a link). Peek forces a real AMQP round-trip to the broker and is non-destructive (no lock/complete), requiring only the Listen claim. Default per-call timeout is 10 s (configurable).

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
1.0.0 98 7/6/2026
0.6.0 112 5/5/2026
0.5.0 519 12/10/2025
0.3.0 368 6/26/2023
0.2.0 786 3/29/2022
0.1.0 729 3/22/2022