AzureServiceBus.Interaction 2.1.3

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

AzureServiceBus.Interaction Librería liviana para facilitar la integración con Azure Service Bus (colas) en proyectos .NET. Permite enviar y recibir mensajes JSON de forma simple, soporta múltiples consumidores simultáneos, reintentos automáticos con Polly, y se registra fácilmente mediante IServiceCollection.

🚀 Características principales • ✅ Envío de mensajes JSON serializados • ✅ Consumo automático con BackgroundService • ✅ Soporte para múltiples colas simultáneas • ✅ Reintentos automáticos con Polly • ✅ Configuración por código (sin dependencia de appsettings.json) • ✅ Diseñado exclusivamente para microservicios backend • 🔒 Dead-letter handling básico integrado • 🧪 Preparado para publicación como paquete NuGet

📦 Instalación Requisitos Agregar la referencia a Polly (usado para reintentos): dotnet add package Polly Agregá la librería AzureServiceBus.Interaction como proyecto o paquete NuGet (próximamente).

🛠️ Registro en Program.cs using AzureServiceBus.Interaction; using AzureServiceBus.Interaction.Extensions; using AzureServiceBus.Interaction.Sender;

var builder = WebApplication.CreateBuilder(args);

// Leer connection string (desde config o directo) var connectionString = builder.Configuration.GetConnectionString("AzureServiceBus");

builder.Services.AddAzureServiceBusInteraction(options ⇒ { options.ConnectionString = connectionString; });

// Registrar un consumidor builder.Services.AddAzureServiceBusConsumer<ClienteCreado, ClienteCreadoHandler>("clientes-queue");

var app = builder.Build();

app.Run();

📩 Enviar mensajes public class ClienteCreado { public string Nombre { get; set; } public string Email { get; set; } }

public class ClienteService { private readonly IAzureServiceBusSender _sender;

public ClienteService(IAzureServiceBusSender sender) { _sender = sender; }

public async Task CrearClienteAsync() { var cliente = new ClienteCreado { Nombre = "Juan", Email = "juan@mail.com" }; await _sender.SendMessageAsync("clientes-queue", cliente); } }

📥 Consumir mensajes Implementá la interfaz IAzureMessageHandler<T>: public class ClienteCreadoHandler : IAzureMessageHandler<ClienteCreado> { public Task HandleAsync(ClienteCreado message, CancellationToken cancellationToken) { Console.WriteLine($"Nuevo cliente creado: {message.Nombre}"); return Task.CompletedTask; } } Registrá el handler y la cola en Program.cs: builder.Services.AddScoped<IAzureMessageHandler<ClienteCreado>, ClienteCreadoHandler>(); builder.Services.AddAzureServiceBusConsumer<ClienteCreado, ClienteCreadoHandler>("clientes-queue");

⚙️ Estructura • IAzureServiceBusSender: servicio para enviar mensajes • IAzureMessageHandler<T>: interfaz para manejar mensajes recibidos • AzureQueueBackgroundProcessor<T>: BackgroundService que escucha colas • Reintentos automáticos configurados con Polly (3 intentos con backoff exponencial)

🗺️ Roadmap (próximas mejoras) • Soporte para encabezados (ApplicationProperties) • Publicación y programación de mensajes (scheduled delivery) • Soporte para topics/subscriptions (opcional) • Publicación oficial en NuGet.org

🧪 Testing y casos de uso Pensado para microservicios backend: • Worker Services • APIs ASP.NET Core • Microservicios desacoplados vía mensajería Ideal para entornos con procesamiento asincrónico de eventos, orquestación y arquitectura basada en eventos.

✉️ Consultas, mejoras o feedback: abrí un issue o contactame.

Se Agrego evento generico IntegrationEvent

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.  net9.0 was computed.  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.