RabbitExpress

An easy to use RabbitMQ Client for .Net.

View on GitHub

Example Publisher

This project makes use of the RabbitExpress.QueueClient and utilizes the RabbitExpress.Serializers.JsonSerializer when communicating with the queue.

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>

A simple publisher

The main code makes use of predefined messages and queues. See RabbitExpress.Example.Shared for details.

Making use of the the publisher is as simple as:

using (var qc = new QueueClient<JsonSerializer>(new Uri(config["RabbitExpressConnection"])))
{
    string message;
    do
    {
        Console.Write("Message: ");
        message = Console.ReadLine();
        qc.Publish(Queues.EXAMPLE_QUEUE, new ExampleMessage { Text = message });
    } while (message != "exit");
}

This simple code will publish an ExampleMessage to the RabbitMQ queue called EXAMPLE_QUEUE.