Marquitos.Events.RabbitMQ.Endpoints
1.2.6
dotnet add package Marquitos.Events.RabbitMQ.Endpoints --version 1.2.6
NuGet\Install-Package Marquitos.Events.RabbitMQ.Endpoints -Version 1.2.6
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="Marquitos.Events.RabbitMQ.Endpoints" Version="1.2.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Marquitos.Events.RabbitMQ.Endpoints --version 1.2.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Marquitos.Events.RabbitMQ.Endpoints, 1.2.6"
#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.
// Install Marquitos.Events.RabbitMQ.Endpoints as a Cake Addin #addin nuget:?package=Marquitos.Events.RabbitMQ.Endpoints&version=1.2.6 // Install Marquitos.Events.RabbitMQ.Endpoints as a Cake Tool #tool nuget:?package=Marquitos.Events.RabbitMQ.Endpoints&version=1.2.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Marquitos.Events
A simple event system in top of RabbitMQ using EasyNetQ for AspNetCore applications.
Usage
To notify an event, first create a class that implements the IEvent interface.
// Your event class
public class ExampleCreated : IEvent
{
/// <summary>
/// The example name just created
/// </summary>
public string ExampleName { get; set; } = "My Example";
}
Then inject IEventService to your service and call NotifyAsync to notify your event.
// Your Service class that notifies events
public class ExampleService
{
private readonly IEventService _eventService;
public WeatherForecastController(IEventService eventService)
{
_eventService = eventService;
}
public async Task CreateExampleAsync(string name, CancellationToken cancellationToken = default)
{
// call repository to register the example name
// then notify your event to RabbitMQ
await _eventService.NotifyAsync(new ExampleCreated() { ExampleName = name });
}
}
To consume an event create an event consumer. First create a class that descends of EventConsumer.
public class ExampleConsumer : EventConsumer<ExampleCreated>
{
public override async Task HandleMessageAsync(ExampleCreated message, CancellationToken cancellationToken = default)
{
Console.WriteLine("Received an message!");
await Task.CompletedTask;
}
}
Then register the RabbitMQ Consumer Service Engine and the Event Consumer on your services configuration.
...
// Register the RabbitMQ connections string
builder.Services.AddRabbitMQConnectionWithSystemTextJson(builder.Configuration.GetConnectionString("RabbitConnection"));
// Register the Event Service to notify events
builder.Services.AddRabbitMQEventService();
// Register the Consumer Service Engine
builder.Services.AddRabbitMQConsumerService();
// Register your Consumer
builder.Services.AddRabbitMQEventConsumer<ExampleConsumer, ExampleCreated>((sp, o) =>
{
// For example add two retry options
o.Retries = new[] { 0.5, 1 }; // 30s and 1min
o.IsEnabled = true;
});
...
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Marquitos.Events.RabbitMQ (>= 1.2.6)
-
net8.0
- Marquitos.Events.RabbitMQ (>= 1.2.6)
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 |
---|---|---|
1.2.6 | 39 | 2/8/2025 |