RabbitExpress 1.1.10

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

// Install RabbitExpress as a Cake Tool
#tool nuget:?package=RabbitExpress&version=1.1.10

RabbitExpress

This library provides an easy way to use RabbitMQ from C# or your other preferred .Net language.

Add the reference

In the csproj add a PackageReference to the RabbitExpress.Serializers.JsonSerializer

<ItemGroup>
    <PackageReference Include="RabbitExpress.Serializers.JsonSerializer" Version="1.*" />
</ItemGroup>

or the RabbitExpress.Serializers.MsgPackSerializer package.

<ItemGroup>
    <PackageReference Include="RabbitExpress.Serializers.MsgPackSerializer" Version="1.*" />
</ItemGroup>

Basic usage

Using the QueueClient requires two type parameters. One type parameter defines the queues that will be created by the queue client. The other parameter defines the used serializer. As argument for the constructor the connection string is required in Uri format.

var client = new QueueClient<JsonSerializer>(new Uri("amqps://xxx:yyy@host/instance"));

To publish a message just use the Publish method. A full Publisher example can be found in RabbitExpress.ExamplePublisher.

client.Publish(Queues.EXAMPLE_QUEUE, new ExampleMessage { Text = message });

To listen for new messages use the StartWatch method. A full Worker example can be found in RabbitExpress.ExamplePublisher.

qc.WatchQueue<Queues, ExampleMessage>(Queues.EXAMPLE_QUEUE, m => {...});

RPC usage

Using the QueueClient for RPC is straight forward. You need to define an interface for your RPC proxies.

public interface IExampleService
{
    string Calculate(int number1, int number2);
}

Using void as return type makes the proxy behave like the worker/publisher example. Other return types cause the proxy to block until the result is available. Make sure the return types and parameters are serializeable. Failing to do so will result in unexpected behavior.

Consuming a method from the proxy is easy, you simply get a proxy from the queue client and start to call methods on it.

IExampleService client = qc.RpcClient<IExampleService>();
Console.WriteLine(client.Calculate(2, 4));

Without a service to handle the Request the code above will block forever. Implementing the server just requires another method call on the QueueClient.

qc.RpcServer<IExampleService>(x => x.Calculate(1, 2), new Func<int, int, string>((i1, i2) =>
{
    Console.WriteLine($"Calculating {i1} + {i2}");
    return (i1 + i2).ToString();
}));

For a full example of the RPC pattern see RabbitExpress.Example.RpcClient and RabbitExpress.Example.RpcServer.

Implementing a serializer

Implementing a serializer is very straight forward. Just implement the IExpressSerializer interface and make sure that your class accepts a parameterless default constructor. The interface defines only 3 methods, Serialize and Deserialize. For a full example see the RabbitExpress.JsonSerializer project.

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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  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 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 (2)

Showing the top 2 NuGet packages that depend on RabbitExpress:

Package Downloads
RabbitExpress.Serializers.MsgPackSerializer

A simple MsgPack serializer implementation for usage in RabbitExpress.

RabbitExpress.Serializers.JsonSerializer

A simple JSON serializer implementation for usage in RabbitExpress.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.16 2,372 6/12/2019
1.1.15 2,192 6/8/2019
1.1.14 2,020 6/6/2019
1.1.13 2,119 6/3/2019
1.1.12 1,988 6/3/2019
1.1.11 2,037 6/2/2019
1.1.10 1,962 5/13/2019
1.1.9 1,972 5/11/2019
1.1.8 535 5/11/2019
1.1.7 526 5/2/2019
1.1.6 526 5/2/2019
1.1.5 536 5/1/2019
1.1.4 538 5/1/2019
1.1.3 539 5/1/2019
1.1.2 544 5/1/2019
1.1.1 528 5/1/2019
1.1.0 530 5/1/2019