RabbitMQ.Client.Easy2Use 0.2.1

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 RabbitMQ.Client.Easy2Use --version 0.2.1
                    
NuGet\Install-Package RabbitMQ.Client.Easy2Use -Version 0.2.1
                    
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="RabbitMQ.Client.Easy2Use" Version="0.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RabbitMQ.Client.Easy2Use" Version="0.2.1" />
                    
Directory.Packages.props
<PackageReference Include="RabbitMQ.Client.Easy2Use" />
                    
Project file
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 RabbitMQ.Client.Easy2Use --version 0.2.1
                    
#r "nuget: RabbitMQ.Client.Easy2Use, 0.2.1"
                    
#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.
#addin nuget:?package=RabbitMQ.Client.Easy2Use&version=0.2.1
                    
Install RabbitMQ.Client.Easy2Use as a Cake Addin
#tool nuget:?package=RabbitMQ.Client.Easy2Use&version=0.2.1
                    
Install RabbitMQ.Client.Easy2Use as a Cake Tool

RabbitMQ Easy2Use Framework

Features:

  • Events
    • Publish using publisher
    • Subscribe using attributes
  • Commands
    • Publish commands using publisher
    • Consume commands using attributes
  • Logging
    • Default logging in console
    • Use your logging factory to use your own logger

Setup:

The framework is initialized using an extentionMethod on IServiceCollection

// in startup.cs
var options = new BusOptions("DemoExchange"); // exhange name is required

services.InitializeRabbitMQ(options);

BusOptions:

var options = new BusOptions("DemoExchange", // exhange name is required
    hostName: "localhost", // the other parameters are optional
    port: 5672,
    userName: "guest",
    password: "guest");

Dependency injection & Logging

var serviceProvider = services.BuildServiceProvider();

ILoggerFactory loggerFactory = new LoggerFactory()
    .AddSerilog(new LoggerConfiguration()
    .MinimumLevel.Information()
    .Enrich.FromLogContext()
    .WriteTo.Console()
    .WriteTo.File(new JsonFormatter(), "RabbitMQFramework_Log.json", LogEventLevel.Warning)
    .CreateLogger());

services.InitializeRabbitMQ(options, serviceProvider, loggerFactory);

Usage:

Publish events:

var publisher = new EventPublisher(options); // use the same busoptions as during initialize (advised is to use DI for this)
publisher.Publish(new ExampleEvent("Example.Demo.ExampleEvent") { Name = "Voorbeeld", Test = 1155 });

Subscribe to events:

[Topic("Example.#.ExampleEvent2")] // the exhange will filter the events with the given topics
[Topic("Example.Demo.*")]
[EventListener("ExampleQueue")] // use this attribute to make the framework recognize this class as a Listener (it requires the queuename)
 public class ExampleListener
 {
     private IExampleInjection _injected;

     public ExampleListener(IExampleInjection exampleInjection) // to use dependency injection, you must pass a buildServiceProvider in the BusOptions during initializing
     {
         _injected = exampleInjection;
     }

     [ExecuteOnEvent] // with this attribute the framework will see this method as a callback method
     public void ExampleEventName(ExampleEvent evt) // events of this type will call this method
     {
         Console.WriteLine($"Wow an event happened and its name was \"{evt.Name}\"");
         _injected.Print();
     }

     [ExecuteOnEvent]
     public void ExampleEventName2(ExampleEvent2 evt)
     {
         Console.WriteLine($"Wow an event happened and its name was \"{evt.Name}\"");
         _injected.Print();
     }
 }

Publish commands:

CommandPublisher commander = new CommandPublisher(options); // use the same busoptions as during initialize (advised is to use DI for this)
string result = commander.Call(new ExampleCommand()); // the result will be in JSON format

Consume commands:

[CommandConsumer] // use this attribute to make the framework recognize this class as a Consumer
public class ExampleConsumer
{
    public object ExampleCommandReceived(ExampleCommand command)
    {
        Console.WriteLine("I will do some things becouse I got a command");
        Thread.Sleep(1000);
        Console.WriteLine("Consumer is done!");
        return new { text = "can you read this?" };
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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.  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. 
.NET Core netcoreapp2.0 is compatible.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 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

- commands now listen to unique queue to support multiple services using commands