Fermion.EventBus.InMemory
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.InMemory --version 1.0.0
NuGet\Install-Package Fermion.EventBus.InMemory -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.InMemory" 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.InMemory" Version="1.0.0" />
<PackageReference Include="Fermion.EventBus.InMemory" />
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.InMemory --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Fermion.EventBus.InMemory, 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.InMemory@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.InMemory&version=1.0.0
#tool nuget:?package=Fermion.EventBus.InMemory&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Fermion.EventBus.InMemory
Fermion.EventBus.InMemory is a NuGet package that provides an in-memory implementation of the event bus for .NET applications. It's designed for testing and single-instance applications where a distributed message broker is not required.
Features
- 🚀 In-memory event processing using channels
- 🔄 Asynchronous event handling
- 📦 Easy integration with dependency injection
- 🔍 Automatic subscription management
- 🛡️ Error handling and logging
- 🏗️ Extensible architecture
Installation
dotnet add package Fermion.EventBus.InMemory
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
services.AddEventBusInMemory(options =>
{
options.SubscriberClientAppName = AppDomain.CurrentDomain.FriendlyName;
options.EventNamePrefix = string.Empty;
options.EventNameSuffix = string.Empty;
// Register event handlers
options.AddEventHandler<UserCreatedEventHandler>();
// Add subscriptions
options.AddSubscription<UserCreatedEvent, UserCreatedEventHandler>();
});
4. Publish and Subscribe to 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...
await _eventBus.PublishAsync(new UserCreatedEvent
{
UserId = "123",
UserName = "John Doe"
});
return Ok();
}
}
Configuration Options
Option | Description | Default |
---|---|---|
SubscriberClientAppName | Subscriber client application name | Application name |
EventNamePrefix | Prefix for event names | "" |
EventNameSuffix | Suffix for event names | "" |
Event Handler Registration
The package provides two methods for registering event handlers:
Using
AddEventHandler<T>()
:options.AddEventHandler<UserCreatedEventHandler>();
Using
AddSubscription<TEvent, THandler>()
:options.AddSubscription<UserCreatedEvent, UserCreatedEventHandler>();
Error Handling
The in-memory event bus includes built-in error handling and logging:
- Event processing errors are caught and logged
- Failed event processing doesn't affect other events
- Detailed error information is available in logs
Best Practices
- Use for testing and single-instance applications
- Register all event handlers during startup
- Implement proper error handling in event handlers
- Use logging for monitoring and debugging
- Consider using the distributed event bus for production environments
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
- Fermion.EventBus.Base (>= 1.0.0)
- Microsoft.Extensions.Hosting (>= 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 |
---|