SolTechnology.Core.MessageBus 0.5.0

dotnet add package SolTechnology.Core.MessageBus --version 0.5.0
                    
NuGet\Install-Package SolTechnology.Core.MessageBus -Version 0.5.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="0.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SolTechnology.Core.MessageBus" Version="0.5.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 0.5.0
                    
#r "nuget: SolTechnology.Core.MessageBus, 0.5.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@0.5.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=0.5.0
                    
Install as a Cake Addin
#tool nuget:?package=SolTechnology.Core.MessageBus&version=0.5.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
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
0.5.0 429 12/10/2025
0.3.0 322 6/26/2023
0.2.0 731 3/29/2022
0.1.0 685 3/22/2022