BridgingIT.DevKit.Infrastructure.Azure.ServiceBus
3.0.3-preview.0.25
See the version list below for details.
dotnet add package BridgingIT.DevKit.Infrastructure.Azure.ServiceBus --version 3.0.3-preview.0.25
NuGet\Install-Package BridgingIT.DevKit.Infrastructure.Azure.ServiceBus -Version 3.0.3-preview.0.25
<PackageReference Include="BridgingIT.DevKit.Infrastructure.Azure.ServiceBus" Version="3.0.3-preview.0.25" />
paket add BridgingIT.DevKit.Infrastructure.Azure.ServiceBus --version 3.0.3-preview.0.25
#r "nuget: BridgingIT.DevKit.Infrastructure.Azure.ServiceBus, 3.0.3-preview.0.25"
// Install BridgingIT.DevKit.Infrastructure.Azure.ServiceBus as a Cake Addin #addin nuget:?package=BridgingIT.DevKit.Infrastructure.Azure.ServiceBus&version=3.0.3-preview.0.25&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.25&prerelease
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.
*** 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 | Versions 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. |
-
net8.0
- Azure.Identity (>= 1.12.0)
- Azure.Messaging.ServiceBus (>= 7.18.1)
- BridgingIT.DevKit.Application.Messaging (>= 3.0.3-preview.0.25)
- BridgingIT.DevKit.Common.Serialization (>= 3.0.3-preview.0.25)
- Ensure.That (>= 10.1.0)
- Microsoft.IdentityModel.JsonWebTokens (>= 8.0.2)
- System.IdentityModel.Tokens.Jwt (>= 8.0.2)
- System.Net.Http (>= 4.3.4)
- System.Text.Json (>= 8.0.4)
- System.Text.RegularExpressions (>= 4.3.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
## Release 3.0.1 [25.04.24]
- [N] Initial release
-----
- [N] New
- [M] Modified
- [B] Breaking