AliceMQ 1.0.11

dotnet add package AliceMQ --version 1.0.11                
NuGet\Install-Package AliceMQ -Version 1.0.11                
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="AliceMQ" Version="1.0.11" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AliceMQ --version 1.0.11                
#r "nuget: AliceMQ, 1.0.11"                
#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 AliceMQ as a Cake Addin
#addin nuget:?package=AliceMQ&version=1.0.11

// Install AliceMQ as a Cake Tool
#tool nuget:?package=AliceMQ&version=1.0.11                

AliceMQ

<img src="https://github.com/jkone27/AliceMQ/blob/master/Pics/Whiterabbit_tenniel.jpg?raw=true" width="20%" height="20%"/>

An easy to use frontend for MQ system (now supporting RabbitMq only, but would be nice to extend to other systems) using Reactive Extensions and a Publish/Subscribe paradigm.

contributions welcome

Mailman (Producer)

Usage of a mailman is dead simple:

using AliceMQ.MailMan; //..

var source = new Source("A", "A.q");
var endPoint = new EndPoint();
var sink = new Sink(source);

var serialization = new JsonSerializerSettings
            {
                MissingMemberHandling = MissingMemberHandling.Error
            };

 var p = new Mailman(endPoint, source.Exchange, s => JsonConvert.SerializeObject(s, serialization));

//first message published creates exchange if non existent
p.PublishOne(new Msg(-1),"");

Now let's see the simplest form of consumer, which is just a thin layer from the real MQ system...

Mailbox (Consumer)

Consumer subscription is identical for every type, giving an istance of an IObservable<T> (rx).

using AliceMQ.Mailbox;

var mb = new SimpleMailbox(endPoint, sink);

var d = mb.Subscribe(am =>
{
    Console.WriteLine("A - " + Encoding.UTF8.GetString(am.EventArgs.Body));
    am.Channel.BasicAck(am.EventArgs.DeliveryTag, false);
});

//...
d.Dispose();

CustomMailBox (Typed Consumer)

let's consider an example DTO class Msg, the typed consumer is build upon the common consumer, which is enhanced with message body deserialization into an istance of a generic T type.

var sfm = new Mailbox<Msg>(endPoint, sink, s => JsonConvert.DeserializeObject<Msg>(s, serialization));

var d = sfm.Subscribe(am =>
{
    if (am.IsOk<Msg>())
    {
        var msg = am.AsOk<Msg>().Message;
        Console.WriteLine("ok - " + msg.Bla);
        am.Confirm();
    }
    else
    {
        Console.WriteLine("error - " + am.AsError().Ex.Message);
        am.Confirm();
    }
},
ex => Console.WriteLine("COMPLETE ERROR"),
() => Console.WriteLine("COMPLETE"));

//...
d.Dispose();

Mailbox and Mailman Args

Both Mailman and Mailbox need that you provide some basic parameters for configuring the Endpoint, the Source (namely Exchange and Queue), and the Mailbox (with more sofisticated configurations).

EndpointArgs

string ConnectionUrl
bool AutomaticRecoveryEnabled
TimeSpan NetworkRecoveryInterval

Source

IExchange Exchange
IQueueArgs QueueArgs

IExchange

string ExchangeName
string ExchangeType
bool Durable
bool AutoDelete
IDictionary<string, object> Properties

IQueueArgs

string QueueName
bool Durable
bool Exclusive
bool AutoDelete

Sink

string DeadLetterExchangeName
IDictionary<string, object> QueueDeclareArguments
Source Source
BasicQualityOfService BasicQualityOfService
ConfirmationPolicy ConfirmationPolicy 
QueueBind QueueBind

QueueBind

string RoutingKey
IDictionary<string, object> Arguments

BasicQualityOfService

ushort PrefetchCount
bool Global

ConfirmationPolicy

bool AutoAck
bool Multiple
bool Requeue

Status

Build Status

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. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.5 is compatible.  netstandard1.6 was computed.  netstandard2.0 was computed.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.11 1,826 11/14/2017
1.0.10 1,870 7/24/2017
1.0.9 1,621 7/24/2017
1.0.8 1,800 7/24/2017
1.0.7 1,640 7/12/2017
1.0.6 1,632 6/4/2017
1.0.5 1,635 5/31/2017
1.0.4 1,617 5/5/2017
1.0.3 1,682 4/27/2017
1.0.1 1,566 4/27/2017
1.0.0 1,613 4/24/2017

updated to dotnetcore