Toosame.EventBus.RabbitMQ
9.0.3
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Toosame.EventBus.RabbitMQ --version 9.0.3
NuGet\Install-Package Toosame.EventBus.RabbitMQ -Version 9.0.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="Toosame.EventBus.RabbitMQ" Version="9.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Toosame.EventBus.RabbitMQ" Version="9.0.3" />
<PackageReference Include="Toosame.EventBus.RabbitMQ" />
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 Toosame.EventBus.RabbitMQ --version 9.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Toosame.EventBus.RabbitMQ, 9.0.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 Toosame.EventBus.RabbitMQ@9.0.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=Toosame.EventBus.RabbitMQ&version=9.0.3
#tool nuget:?package=Toosame.EventBus.RabbitMQ&version=9.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Toosame.EventBus
An Event Bus Based on RabbitMQ, whose core code is from eShopOnContainers, I just pulled it out and made some extensions, fixes and improvements.
I currently only use it for microservices. If your project has only one ASP. NET Core project, then it may not be suitable for you.
Install from Nuget.org
PM> Install-Package Toosame.EventBus.RabbitMQ -Version 2.1.0
Using (Publish Event)
- Add Event
- Add Event Handler
- Publish Event in Controller
1. Add Event
Create YourEvent.cs
public record class YourEvent : IntegrationEvent
{
public string Name { get; set; }
public int Age { get; set; }
}
2. Add Event Handler
Create YourEventHandler.cs
public class YourEventHandler : IIntegrationEventHandler<YourEvent>
{
private readonly IConfiguration _configuration;
public YourEventHandler(IConfiguration configuration){
//I'm just telling you that you can also use Dependency Injection Services.
_configuration = configuration;
}
public Task Handle(YourEvent @event)
{
//you can get @event.Name
//you can get @event.Age
//Do something...
return Task.CompletedTask;
}
}
3. Publish Event in Controller
public class HomeController : ControllerBase
{
private readonly IEventBus _eventBus;
public YourEventHandler(IEventBus eventBus){
_eventBus = eventBus;
}
[HttpGet]
public IAcionResult Index(){
_eventBus.Publish(new YourEvent(){
Name: "my name",
Age: 22
})
}
}
Setup (ASP.NET Core 9.0)
You can subscribe to the event you just created here.
- Configure appsettings.json
- Setup on
Program.cs
1. Configure appsettings.json
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"RabbitMQOption": {
"EventBusRetryCount": 5,
"EventBusBrokeName": "<rabbitMqExchangeName>",
"SubscriptionClientName": "<queueName>" //It's better to have different microservices with different names
}
}
2.Setup on Program.cs
builder.Services.AddEventBus(Configuration.GetConnectionString("RabbitMQ"), Configuration.GetSection("RabbitMQOption"))
.AddSubscription<YourEvent1, YourEventHandler1>();
3.Add YourHostedService.cs
builder.Services.AddHostedService<YourHostedService>();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. 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.
-
net9.0
- Polly (>= 8.5.2)
- RabbitMQ.Client (>= 7.1.1)
- Toosame.EventBus (>= 2.1.0)
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 | |
---|---|---|---|
9.0.9 | 98 | 7/13/2025 | |
9.0.8 | 98 | 7/13/2025 | |
9.0.7 | 211 | 4/17/2025 | |
9.0.6 | 196 | 4/16/2025 | |
9.0.5 | 305 | 4/16/2025 | |
9.0.3 | 155 | 3/18/2025 | |
9.0.2 | 146 | 3/18/2025 | |
9.0.1 | 158 | 3/18/2025 | |
9.0.0 | 147 | 3/17/2025 | |
2.0.1 | 262 | 4/2/2023 | |
2.0.0 | 391 | 11/11/2022 | |
1.1.9 | 432 | 12/10/2021 | |
1.1.8 | 475 | 4/21/2021 | |
1.1.7 | 706 | 8/5/2020 | |
1.1.6 | 575 | 6/23/2020 | |
1.1.5 | 1,153 | 10/4/2019 | |
1.1.3 | 805 | 9/29/2019 | |
1.1.2 | 757 | 8/10/2019 | |
1.1.1 | 640 | 8/10/2019 | |
1.1.0 | 644 | 8/10/2019 | |
1.0.9 | 892 | 7/8/2019 | |
1.0.8 | 622 | 7/8/2019 | |
1.0.7 | 822 | 6/21/2019 | |
1.0.6 | 653 | 6/20/2019 | |
1.0.5 | 616 | 6/20/2019 | |
1.0.4 | 612 | 6/20/2019 | |
1.0.3 | 776 | 5/30/2019 | |
1.0.2 | 628 | 5/29/2019 | |
1.0.1 | 607 | 5/29/2019 | |
1.0.0 | 734 | 5/11/2019 |