BridgingIT.DevKit.Infrastructure.Azure.ServiceBus 3.0.3-preview.0.6

This is a prerelease version of BridgingIT.DevKit.Infrastructure.Azure.ServiceBus.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package BridgingIT.DevKit.Infrastructure.Azure.ServiceBus --version 3.0.3-preview.0.6
NuGet\Install-Package BridgingIT.DevKit.Infrastructure.Azure.ServiceBus -Version 3.0.3-preview.0.6
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="BridgingIT.DevKit.Infrastructure.Azure.ServiceBus" Version="3.0.3-preview.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BridgingIT.DevKit.Infrastructure.Azure.ServiceBus --version 3.0.3-preview.0.6
#r "nuget: BridgingIT.DevKit.Infrastructure.Azure.ServiceBus, 3.0.3-preview.0.6"
#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.
// Install BridgingIT.DevKit.Infrastructure.Azure.ServiceBus as a Cake Addin
#addin nuget:?package=BridgingIT.DevKit.Infrastructure.Azure.ServiceBus&version=3.0.3-preview.0.6&prerelease

// Install BridgingIT.DevKit.Infrastructure.Azure.ServiceBus as a Cake Tool
#tool nuget:?package=BridgingIT.DevKit.Infrastructure.Azure.ServiceBus&version=3.0.3-preview.0.6&prerelease

bITDevKit

Empowering developers with modular components for modern application development, centered around Domain-Driven Design principles.

Our goal is to empower developers by offering modular components that can be easily integrated into your projects. Whether you're working with repositories, commands, queries, or other components, the bITDevKit provides flexible solutions that can adapt to your specific needs.

This repository includes the complete source code for the bITDevKit, along with a variety of sample applications located in the ./examples folder within the solution. These samples serve as practical demonstrations of how to leverage the capabilities of the bITDevKit in real-world scenarios. All components are available as nuget packages.

For the latest updates and release notes, please refer to the RELEASES.

Join us in advancing the world of software development with the bITDevKit!

Azure Service Bus Messaging (Broker implementation)

Getting Stared: https://azuresdkdocs.blob.core.windows.net/$web/dotnet/Azure.Messaging.ServiceBus/7.14.0/index.html Research: https://chat.openai.com/share/90316478-d295-4c7b-9e8f-4861ca39097e

Topics are useful in publish/subscribe scenarios. alternate text is missing from this package README image

*** standard tier is necessary to use topics

Sending (Sender per topic):

  • use ServiceBusClient to communicate with Azure Service Bus
  • create a sender to send messages to a topic (messagename)
    await using var client = new ServiceBusClient(connectionString);
    ServiceBusSender sender = client.CreateSender(topicName);
    await sender.SendMessageAsync(message);
  • topic needs to be created on the fly (ManagementClient)
    ManagementClient managementClient = new ManagementClient(connectionString);
    TopicDescription topicDescription = await managementClient.GetTopicAsync(topicName);

Receiving (Processor per topic):

    var processor = client.CreateProcessor(topicName, subscriptionName);

when the number of topics is undefined (onsubscribe), you can dynamically create and register multiple processors for each topic

using Azure.Messaging.ServiceBus;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string connectionString = "<your-connection-string>";
        List<string> topicNames = GetTopicNames(); // Get a list of topic names dynamically

        // Create the ServiceBusClient
        ServiceBusClient serviceBusClient = new ServiceBusClient(connectionString);

        try
        {
            List<ServiceBusProcessor> processors = new List<ServiceBusProcessor>();

            // Create and register a processor for each topic
            foreach (string topicName in topicNames)
            {
                ServiceBusProcessor processor = serviceBusClient.CreateProcessor(topicName, subscriptionName);

                processor.ProcessMessageAsync += async args =>
                {
                    var message = args.Message;
                    try
                    {
                        // Process the message here
                        Console.WriteLine($"Received message from topic '{topicName}': {message.Body}");

                        // Complete the message to remove it from the subscription
                        await args.CompleteMessageAsync(message);
                    }
                    catch (Exception ex)
                    {
                        // Handle any exceptions that occur during message processing
                        Console.WriteLine($"Error processing message: {ex}");
                        await args.AbandonMessageAsync(message);
                    }
                };

                processors.Add(processor);
                await processor.StartProcessingAsync();
            }

            Console.WriteLine("Receiving messages... Press any key to stop.");
            Console.ReadKey();

            // Stop processing messages and close the processors
            foreach (var processor in processors)
            {
                await processor.StopProcessingAsync();
                await processor.CloseAsync();
            }
        }
        catch (Exception ex)
        {
            // Handle any exceptions
            Console.WriteLine($"Exception: {ex.Message}");
        }
        finally
        {
            // Close the ServiceBusClient
            await serviceBusClient.DisposeAsync();
        }
    }

    static List<string> GetTopicNames()
    {
        // Implement the logic to dynamically fetch the topic names
        // For example, retrieve topic names from a configuration source or a data store
        // and return them as a list
        List<string> topicNames = new List<string>();
        // Add your logic to populate the topicNames list
        return topicNames;
    }
}

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. 
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
3.0.3-preview.0.14 37 6/24/2024
3.0.3-preview.0.13 35 6/23/2024
3.0.3-preview.0.12 38 6/21/2024
3.0.3-preview.0.11 37 6/20/2024
3.0.3-preview.0.9 40 5/27/2024
3.0.3-preview.0.8 41 5/27/2024
3.0.3-preview.0.7 47 5/17/2024
3.0.3-preview.0.6 42 5/14/2024
3.0.3-preview.0.5 45 5/8/2024
3.0.3-preview.0.3 51 5/6/2024
3.0.3-preview.0.1 50 4/25/2024
3.0.2 81 4/25/2024
3.0.2-preview.0.4 47 4/25/2024
3.0.2-preview.0.3 43 4/25/2024
3.0.2-preview.0.2 52 4/25/2024
3.0.2-preview.0.1 44 4/25/2024
3.0.1 90 4/25/2024
3.0.1-preview.0.10 51 4/24/2024
3.0.1-preview.0.9 31 4/19/2024
3.0.1-preview.0.8 35 4/24/2024
3.0.1-preview.0.7 41 4/24/2024

## Release 3.0.1 [25.04.24]

- [N] Initial release

-----
- [N] New
- [M] Modified
- [B] Breaking