Brer 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Brer --version 0.1.0                
NuGet\Install-Package Brer -Version 0.1.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="Brer" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Brer --version 0.1.0                
#r "nuget: Brer, 0.1.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.
// Install Brer as a Cake Addin
#addin nuget:?package=Brer&version=0.1.0

// Install Brer as a Cake Tool
#tool nuget:?package=Brer&version=0.1.0                

Brer

A rabbitMQ library for ASP.NET.

Special thanks to Marco Pil

How do i use Brer?

Brer makes use of a hostedservice in ASP.NET.

A basic brer startup example can be found here.

Initial Setup

In short one must register the Brer services as follows:

services.UseBrer(
    new BrerOptionsBuilder().WithAddress(BrerOptionsBuilder.localHost, BrerOptionsBuilder.defaultPort)
        .WithPassWord(BrerOptionsBuilder.defaultLogin)
        .WithUserName(BrerOptionsBuilder.defaultLogin)
        .WithExchange("MyExchange")
        .WithQueueName("MyQueue")
        .Build()
);

Brer can also be configured using environment variables as follows:

services.UseBrer(new BrerOptionsBuilder().ReadFromEnviromentVariables().Build());

Where it will look for the following variables:

  • BrerHostName
  • BrerPort
  • BrerExchangeName
  • BrerQueueName
  • BrerUserName
  • BrerPassword

Registering/Decorating an EventListener

Brer will automatically scan all referencing assemblies for EventListeners.

Once a class is annoted with the EventListener attribute it will further scan the class for Handlers.

NOTE: wildcards are currently not (officially) supported.

[EventListener]
public class MyEventHandler{

    [Handler(topic:"MyTopic")]
    public async Task Handle(MyEvent @event){
        // do stuff
    }

}

Publishing events.

To publish an event simply inject the IBrerPublisher into your class.

public class MyEventPublisher{

    private readonly IBrerPublisher _brerPublisher;

    MyEventPublisher(IBrerPublisher brerPublisher){
        _brerPublisher = brerPublisher;
    }

    PublishEvent(){
        _brerPublisher.Publish("MyTopic", MyEvent)
    }
}

I want to contribute!

As of now we'd greatly appreciate more Example projects & unit-testing of the library.

notes:

  • No global usings
  • Use SonarLint
  • Rider/ReSharper default styling preferred

I'm missing a feature!

Simply open an issue

Product 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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0.13 109 6/30/2024
1.0.12 106 5/27/2024
1.0.11 93 5/8/2024
1.0.1 103 4/26/2024
1.0.0 104 4/26/2024
0.1.1 108 4/26/2024
0.1.0 181 7/10/2023

Initial release.