Fermion.EventBus.AzureServiceBus
1.0.0
The owner has unlisted this package.
This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Fermion.EventBus.AzureServiceBus --version 1.0.0
NuGet\Install-Package Fermion.EventBus.AzureServiceBus -Version 1.0.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="Fermion.EventBus.AzureServiceBus" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Fermion.EventBus.AzureServiceBus" Version="1.0.0" />
<PackageReference Include="Fermion.EventBus.AzureServiceBus" />
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 Fermion.EventBus.AzureServiceBus --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Fermion.EventBus.AzureServiceBus, 1.0.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 Fermion.EventBus.AzureServiceBus@1.0.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=Fermion.EventBus.AzureServiceBus&version=1.0.0
#tool nuget:?package=Fermion.EventBus.AzureServiceBus&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Fermion.EventBus.AzureServiceBus
A robust Azure Service Bus implementation of the event bus pattern for .NET applications. This package provides distributed event processing capabilities using Azure Service Bus as the message broker.
Features
- 🚀 Distributed Event Processing: Publish and subscribe to events across multiple applications
- 🔄 Automatic Reconnection: Built-in retry mechanism for handling connection issues
- 🔒 Persistent Connections: Reliable message delivery with persistent connections
- 🏥 Health Checks: Built-in health monitoring for Azure Service Bus connections
- ⚙️ Flexible Configuration: Easy configuration through options pattern
- 🔍 Detailed Logging: Comprehensive logging for debugging and monitoring
- 🛡️ Error Handling: Robust error handling with custom exceptions
Installation
dotnet add package Fermion.EventBus.AzureServiceBus
Quick Start
- Configure the Azure Service Bus event bus in your
Program.cs
:
builder.Services.AddEventBusAzureServiceBus(options =>
{
// Configure Azure Service Bus connection
options.ConnectionString = "your_connection_string";
options.DefaultTopicName = "MyApplication";
options.ConnectionRetryCount = 5;
// Register event handlers
options.AddEventHandler<UserCreatedEventHandler>();
// Subscribe to events
options.AddSubscription<UserCreatedEvent, UserCreatedEventHandler>();
});
- Define your integration event:
public class UserCreatedEvent : IntegrationEvent
{
public Guid UserId { get; }
public string UserName { get; }
public UserCreatedEvent(Guid userId, string userName)
{
UserId = userId;
UserName = userName;
}
}
- Create an event handler:
public class UserCreatedEventHandler : IIntegrationEventHandler<UserCreatedEvent>
{
private readonly ILogger<UserCreatedEventHandler> _logger;
public UserCreatedEventHandler(ILogger<UserCreatedEventHandler> logger)
{
_logger = logger;
}
public async Task HandleAsync(UserCreatedEvent @event)
{
_logger.LogInformation("User created: {UserId}, {UserName}", @event.UserId, @event.UserName);
// Handle the event
}
}
- Publish events:
public class UserController : ControllerBase
{
private readonly IEventBus _eventBus;
public UserController(IEventBus eventBus)
{
_eventBus = eventBus;
}
[HttpPost]
public async Task<IActionResult> CreateUser(CreateUserRequest request)
{
// Create user logic...
var @event = new UserCreatedEvent(userId, request.UserName);
await _eventBus.PublishAsync(@event);
return Ok();
}
}
Configuration Options
Option | Description | Default Value |
---|---|---|
ConnectionString |
Azure Service Bus connection string | "" |
DefaultTopicName |
Default topic name for event publishing | "DefaultTopic" |
ConnectionRetryCount |
Number of connection retry attempts | 5 |
SubscriberClientAppName |
Subscriber client application name | Current domain name |
EventNamePrefix |
Prefix for event names | "" |
EventNameSuffix |
Suffix for event names | "" |
EnableHealthCheck |
Enable health checks | true |
HealthCheckInterval |
Health check interval | 30 seconds |
Health Checks
The package includes built-in health checks for Azure Service Bus connections. To enable health checks:
builder.Services.AddEventBusAzureServiceBus(options =>
{
options.EnableHealthCheck = true;
options.HealthCheckInterval = TimeSpan.FromSeconds(30);
});
Error Handling
The package provides custom exceptions for different error scenarios:
EventBusException
: Base exception for event bus errorsConnectionError
: Raised when there are connection issuesPublishingError
: Raised when event publishing failsSubscriptionError
: Raised when subscription operations fail
Best Practices
Connection Management:
- Use persistent connections for reliable message delivery
- Configure appropriate retry counts for your environment
- Monitor connection health through health checks
Event Design:
- Keep events immutable
- Include only necessary data in events
- Use meaningful event names
Error Handling:
- Implement proper error handling in event handlers
- Use logging for debugging and monitoring
- Handle connection issues gracefully
Performance:
- Configure appropriate connection retry intervals
- Monitor message processing times
- Use appropriate topic and subscription configurations
Security:
- Store connection strings securely (e.g., in Azure Key Vault)
- Use managed identities when possible
- Implement proper access control for topics and subscriptions
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. 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.
-
net8.0
- Azure.Messaging.ServiceBus (>= 7.19.0)
- Fermion.EventBus.Base (>= 1.0.0)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 9.0.3)
- Microsoft.Extensions.Hosting (>= 9.0.3)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.3)
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 |
---|