Fermion.EventBus.Base
1.0.0
dotnet add package Fermion.EventBus.Base --version 1.0.0
NuGet\Install-Package Fermion.EventBus.Base -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.Base" 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.Base" Version="1.0.0" />
<PackageReference Include="Fermion.EventBus.Base" />
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.Base --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Fermion.EventBus.Base, 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.Base@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.Base&version=1.0.0
#tool nuget:?package=Fermion.EventBus.Base&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Fermion.EventBus.Base
Fermion.EventBus.Base is a NuGet package that provides the core infrastructure for implementing event-driven architecture in .NET applications. It offers a flexible and extensible foundation for managing integration events.
Features
- 🚀 Easy integration event management
- 🔄 Asynchronous event processing
- 📦 Flexible configuration options
- 🔍 Event subscription management
- 🛡️ Error handling and monitoring
- 🏗️ Extensible architecture
Installation
dotnet add package Fermion.EventBus.Base
Usage
1. Define Your Event
public class UserCreatedEvent : IntegrationEvent
{
public string UserId { get; set; }
public string UserName { get; set; }
}
2. Create an Event Handler
public class UserCreatedEventHandler : IIntegrationEventHandler<UserCreatedEvent>
{
private readonly ILogger<UserCreatedEventHandler> _logger;
public UserCreatedEventHandler(ILogger<UserCreatedEventHandler> logger)
{
_logger = logger;
}
public async Task Handle(UserCreatedEvent @event)
{
_logger.LogInformation("User created: {UserId}, {UserName}",
@event.UserId, @event.UserName);
await Task.CompletedTask;
}
}
3. Configure EventBus
// Using the builder pattern
var config = EventBusConfig.CreateBuilder()
.WithConnectionRetryCount(5)
.WithDefaultTopicName("DefaultTopicName")
.WithSubscriberClientAppName(AppDomain.CurrentDomain.FriendlyName)
.WithEventNamePrefix(string.Empty)
.WithEventNameSuffix(string.Empty)
.Build();
// Register in DI container
services.AddSingleton<IEventBus>(sp =>
new YourEventBusImplementation(config, sp));
4. Publish and Subscribe to Events
// Publish an event
await _eventBus.PublishAsync(new UserCreatedEvent
{
UserId = "123",
UserName = "John Doe"
});
// Subscribe to an event
await _eventBus.SubscribeAsync<UserCreatedEvent, UserCreatedEventHandler>();
Configuration Options
Option | Description | Default |
---|---|---|
ConnectionRetryCount | Number of connection retry attempts | 5 |
DefaultTopicName | Default topic name for event publishing | "DefaultTopicName" |
SubscriberClientAppName | Subscriber client application name | Application name |
EventNamePrefix | Prefix for event names | "" |
EventNameSuffix | Suffix for event names | "IntegrationEvent" |
Error Handling
The package supports the following error types:
SubscriptionError
: Errors related to subscription managementPublishingError
: Errors related to event publishingHandlerExecutionError
: Errors related to event handler executionConnectionError
: Errors related to event bus connectionConfigurationError
: Errors related to event bus configuration
Integration with Other Packages
Fermion.EventBus.Base can be extended with additional packages:
Fermion.EventBus.RabbitMq
: RabbitMQ implementationFermion.EventBus.InMemory
: In-memory implementation for testing
Example with RabbitMQ:
services.AddEventBusRabbitMq(options =>
{
options.ConnectionRetryCount = 5;
options.DefaultTopicName = "DefaultTopicName";
options.SubscriberClientAppName = AppDomain.CurrentDomain.FriendlyName;
options.EventNamePrefix = string.Empty;
options.EventNameSuffix = string.Empty;
// RabbitMQ connection settings
options.Host = "localhost";
options.Port = 5672;
options.UserName = "admin";
options.Password = "password";
// Register event handlers
options.AddEventHandler<UserCreatedEventHandler>();
// Add subscriptions
options.AddSubscription<UserCreatedEvent, UserCreatedEventHandler>();
});
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
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.3)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.3)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Fermion.EventBus.Base:
Package | Downloads |
---|---|
Fermion.EventBus.RabbitMq
Package Description |
|
Fermion.EventBus.InMemory
Package Description |
|
Fermion.EventBus.AzureServiceBus
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0 | 263 | 6/9/2025 |