DotNetBrightener.Plugins.EventPubSub.AzureServiceBus 2025.0.6-preview-333

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

Azure Service Bus Enabled for Event PubSub Library

© 2025 DotNet Brightener

Versions

Library Version
EventPubSub Core NuGet Version
Azure Service Bus Library NuGet Version
Dependency Injection Library NuGet Version

Installation

dotnet package add DotNetBrightener.Plugins.EventPubSub
dotnet package add DotNetBrightener.Plugins.EventPubSub.DependencyInjection
dotnet package add DotNetBrightener.Plugins.EventPubSub.AzureServiceBus

Usage

Configuration

Option 1: Use IConfiguration to configure the service bus

builder.Services
        // Initialize EventPubSubService
       .AddEventPubSubService(
                              Assembly.GetExecutingAssembly(),
                              // assemblies where the event messages are defined
                              typeof(DistributedTestMessage).Assembly
                             )
        // Add Azure Service Bus
       .AddAzureServiceBus(builder.Configuration)
        // Add event handlers
       .AddEventHandlersFromAssemblies([
            Assembly.GetExecutingAssembly(),
            // assemblies where the event handlers are defined
        ]);

In your appsettings.json file, add the the following configuration:

"ServiceBusConfiguration": {
    "ConnectionString": "<connection_string_to_Azure_Service_Bus",
    "SubscriptionName": "<your_app_name>"
} 
Option 2: Configure from code

builder.Services
        // Initialize EventPubSubService
       .AddEventPubSubService(
                              Assembly.GetExecutingAssembly(),
                              // assemblies where the event messages are defined
                              typeof(DistributedTestMessage).Assembly
                             )
        // Add Azure Service Bus
       .AddAzureServiceBus("<connection_string_to_Azure_Service_Bus>",
                           "<your_app_name>")
        // Add event handlers
       .AddEventHandlersFromAssemblies([
            Assembly.GetExecutingAssembly(),
            // assemblies where the event handlers are defined
        ]);
Default Configuration Value

If you use appsettings.json to configure the service bus, you can also customize the following configuration values by adding it to the JSON:

Configuration Description Value Type Default Value
ConnectionString The connection string to Azure Service Bus string required, must specify
SubscriptionName The name of the application that subscribes to the events from Azure Service Bus string required, must specify
IncludeNamespaceForTopicName Indicates if the namespace of the class is used for topic name boolean true, means the namespace will be used for topic name.<br />Set to false to only use class name as topic name
AutoDeleteOnIdle The TimeSpan idle interval after which the topic is automatically deleted. TimeSpan TimeSpan.FromDays(90), means the topic will be automatically deleted after 90 days.
DefaultMessageTimeToLive The default time to live value for the messages. This is the duration after which the message expires, starting from when the message is sent to Service Bus. TimeSpan TimeSpan.FromDays(5)
DuplicateDetectionHistoryTimeWindow The TimeSpan duration of duplicate detection history that is maintained by the service. TimeSpan TimeSpan.FromMinutes(1)
MaxSizeInMegabytes The maximum size of the topic in megabytes, which is the size of memory allocated for the topic. long 5120

Event Message Definition

Create a class that represents the event message. The class must implement the IDistributedEventMessage interface.


namespace YourProject.NameSpace;

public class DistributedTestMessage : IDistributedEventMessage
{
    public string Name { get; set; }

    // more payload properties
}

Event Handler Definition

Create a class derived from DistributedEventEventHandler<YourEventMessage> and override HandleEvent method to handle the event message.

With this implementation, you'll be able to access the original payload of the messsage by accessing OriginPayload property.



public class TestEventHandlerDistributed(ILogger<TestEventHandlerDistributed> logger)
    : DistributedEventEventHandler<DistributedTestMessage>
{
    private readonly ILogger _logger = logger;
    
    public override Task<bool> HandleEvent(DistributedTestMessage eventMessage)
    {
        // access the `OriginPayload` 
        var origin = OriginPayload;

        _logger.LogInformation($"Received message: {eventMessage.Name}");

        return Task.FromResult<bool>(true);
    }
}

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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
2026.0.1-preview-notificati... 214 12/6/2025
2026.0.1-preview-net10-upgr... 178 11/25/2025
2026.0.1-preview-net10-upgr... 177 11/25/2025
2026.0.1-preview-net10-upgr... 174 11/24/2025
2026.0.1-preview-net10-upgr... 183 11/24/2025
2026.0.1-preview-717 87 1/5/2026
2026.0.1-preview-713 445 12/10/2025
2026.0.1-preview-700 215 12/7/2025
2026.0.1-preview-689 103 12/6/2025
2026.0.1-preview-676 670 12/2/2025
2026.0.1-preview-671 123 11/29/2025
2026.0.1-preview-670 114 11/29/2025
2026.0.1-preview-669 109 11/29/2025
2026.0.1-preview-667 177 11/27/2025
2026.0.1-preview-665 166 11/27/2025
2026.0.1-preview-664 173 11/27/2025
2026.0.1-preview-660 171 11/25/2025
2025.0.10 178 11/25/2025
2025.0.10-preview-628 390 11/20/2025
2025.0.10-preview-605 276 11/17/2025
2025.0.10-preview-602 270 11/17/2025
2025.0.10-preview-581 292 11/11/2025
2025.0.10-preview-559 182 10/29/2025
2025.0.10-preview-557 181 10/27/2025
2025.0.9 189 10/26/2025
2025.0.9-preview-553 169 10/26/2025
2025.0.9-preview-539 116 10/12/2025
2025.0.9-preview-535 173 10/8/2025
2025.0.9-preview-509 193 10/2/2025
2025.0.9-preview-508 186 10/2/2025
2025.0.9-preview-487 195 9/29/2025
2025.0.9-preview-481 178 9/29/2025
2025.0.9-preview-473 152 9/28/2025
2025.0.8 199 9/23/2025
2025.0.6 186 9/22/2025
2025.0.6-preview-455 190 9/22/2025
2025.0.6-preview-454 307 9/17/2025
2025.0.6-preview-441 150 9/14/2025
2025.0.6-preview-440 143 9/14/2025
2025.0.6-preview-406 179 9/2/2025
2025.0.6-preview-401 171 9/2/2025
2025.0.6-preview-400 161 9/2/2025
2025.0.6-preview-369 223 8/27/2025
2025.0.6-preview-368 201 8/27/2025
2025.0.6-preview-334 181 8/18/2025
2025.0.6-preview-333 159 7/27/2025
2025.0.6-preview-332 507 7/24/2025
2025.0.6-preview-331 517 7/24/2025
2025.0.6-preview-328 504 7/24/2025
2025.0.6-preview-327 367 7/21/2025
2025.0.6-preview-326 364 7/21/2025
2025.0.6-preview-325 267 7/20/2025
2025.0.6-preview-324 262 7/20/2025
2025.0.6-preview-322 271 7/20/2025
2025.0.6-preview-321 264 7/19/2025
2025.0.6-preview-320 271 7/19/2025
2025.0.6-preview-319 173 7/17/2025
2025.0.6-preview-317 170 7/17/2025
2025.0.6-preview-316 172 7/17/2025
2025.0.6-preview-315 174 7/17/2025
2025.0.6-preview-314 159 7/17/2025
2025.0.6-preview-313 162 7/17/2025
2025.0.6-preview-312 176 7/16/2025
2025.0.5 195 7/10/2025
2025.0.5-preview-307 114 7/5/2025
2025.0.4 108 7/5/2025
2025.0.4-preview-305 125 7/4/2025
2025.0.4-preview-304 185 7/1/2025
2025.0.4-preview-299 170 5/31/2025
2025.0.4-preview-298 133 5/30/2025
2025.0.4-preview-296 171 5/30/2025
2025.0.4-preview-295 174 5/29/2025
2025.0.4-preview-293 182 5/26/2025
2025.0.4-preview-292 175 5/26/2025
2025.0.3 157 2/10/2025
2025.0.3-preview-288 148 2/10/2025
2025.0.2 145 1/21/2025
2025.0.2-preview-278 122 1/21/2025
2025.0.2-preview-277 137 12/16/2024
2025.0.1-rc-243301701 406 11/25/2024
2024.0.14.6 153 11/25/2024
2024.0.14.6-rc-243031001 220 10/29/2024
2024.0.14.6-rc-243030701 143 10/29/2024
2024.0.14.6-rc-242840501 132 10/10/2024
2024.0.14.6-rc-242820305 140 10/8/2024
2024.0.14.6-rc-242771401 230 10/3/2024
2024.0.14.6-rc-242770501 143 10/3/2024
2024.0.14.6-rc-242770201 153 10/3/2024
2024.0.14.6-rc-242761801 144 10/2/2024
2024.0.14.6-rc-242761601 152 10/2/2024
2024.0.14.6-rc-242761501 144 10/2/2024
2024.0.14.6-rc-242761401 151 10/2/2024
2024.0.14.6-rc-242760701 157 10/2/2024
2024.0.14.6-rc-242751002 130 10/1/2024
2024.0.14.6-rc-242750901 167 10/1/2024
2024.0.14.6-rc-242750502 142 10/1/2024
2024.0.14.6-rc-242750201 146 10/1/2024
2024.0.14.6-rc-242741501 139 9/30/2024
2024.0.14.6-rc-242730701 156 9/29/2024
2024.0.14.6-preview-2730501 116 9/29/2024
2024.0.14.6-preview-2701501 168 9/26/2024
2024.0.14.6-preview-2620901 190 9/18/2024
2024.0.14.6-preview-2570701 149 9/13/2024
2024.0.14.6-preview-2510703 203 9/7/2024
2024.0.14.6-preview-2480501 161 9/4/2024
2024.0.14.6-preview-2430401 165 8/30/2024
2024.0.14.6-preview-242730701 123 9/29/2024
2024.0.14.6-preview-2421703 132 8/29/2024
2024.0.14.6-preview-2421701 140 8/29/2024
2024.0.14.6-preview-2420901 141 8/29/2024
2024.0.14.6-preview-2390101 153 8/26/2024
2024.0.14.6-preview-2381603 171 8/25/2024
2024.0.14.6-preview-2341601 186 8/21/2024
2024.0.14.6-preview-2321602 163 8/20/2024
2024.0.14.6-preview-2190801 174 8/6/2024
2024.0.14.6-preview-2041501 137 7/22/2024
2024.0.14.6-preview-1920603 206 7/10/2024
2024.0.14.6-preview-1920301 145 7/10/2024
2024.0.14.6-preview-1911302 158 7/9/2024
2024.0.14.6-preview-1901001 175 7/8/2024
2024.0.14.6-preview-1900901 157 7/8/2024
2024.0.14.6-preview-1900801 142 7/8/2024
2024.0.14.6-preview-1860304 143 7/4/2024
2024.0.14.5 209 7/1/2024
2024.0.14.5-preview-1811601 146 6/29/2024
2024.0.14.5-preview-1810501 182 6/29/2024
2024.0.14.5-preview-180132 142 6/28/2024
2024.0.14.5-preview-180131 152 6/28/2024
2024.0.14.5-preview-180121 129 6/28/2024
2024.0.14.4 169 6/27/2024
2024.0.14.4-preview-7 147 6/27/2024
2024.0.14.3 169 6/21/2024
2024.0.14.1 161 6/6/2024
2024.0.14.1-preview 140 6/6/2024
2024.0.14-preview-1 154 6/6/2024
2024.0.13.8-preview 149 6/6/2024
2024.0.13.1-preview-0146 177 6/6/2024
2024.0.12.15803-preview-03 143 6/6/2024
2024.0.12.15608 161 6/4/2024
2024.0.12.15515 241 6/3/2024
2024.0.12.15220 154 5/31/2024
2024.0.12.15220-alpha31-240... 140 5/31/2024
2024.0.12.14911 203 5/28/2024
2024.0.12.14910-alpha28-240... 154 5/28/2024
2024.0.12.14823 192 5/27/2024
2024.0.12.14522-alpha7-2405... 157 5/24/2024
2024.0.12.14514-alpha6-2405... 155 5/24/2024
2024.0.12.14511 168 5/24/2024
2024.0.12.14314 218 5/22/2024
2024.0.12.14114 218 5/20/2024