.NET Standard 2.0 .NET Framework 4.6.1
dotnet add package JN.RabbitMQClient --version
NuGet\Install-Package JN.RabbitMQClient -Version
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="JN.RabbitMQClient" Version="" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JN.RabbitMQClient --version
#r "nuget: JN.RabbitMQClient,"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install JN.RabbitMQClient as a Cake Addin
#addin nuget:?package=JN.RabbitMQClient&version=

// Install JN.RabbitMQClient as a Cake Tool
#tool nuget:?package=JN.RabbitMQClient&version=


Simple implementation of RabbitMQ consumer and sender.


  • Sender implementation
  • Multiple consumer instances supported
  • Multiple processing options for received messages
  • Random expiration for messages sent to an holding queue (depending on the processing option)
  • TLS connection support
  • Limiter for message processing
  • Message properties for more advanced scenarios such as queues with support for priority messages, messages Headers, etc.

More details available on the project website.


Download the package from NuGet:

Install-Package JN.RabbitMQClient -Version [version number]


First, you must create the RabbitMqConsumerService and then define delegates for ReceiveMessage, ShutdownConsumer and ReceiveMessageError. The service will start the required number of consumers when StartConsumers is called.

To use a retry queue, the method StartConsumers should be called with a RetryQueueDetails object.

Message processing instructions

OK - message is considered as successfully processed

RequeueMessageWithDelay - message is removed from the queue, but sent to a holding queue for later processing (typically with a dead letter configuration)

IgnoreMessage - message is removed from the queue and ignored

IgnoreMessageWithRequeue - message is rejected and sent back to the queue


Example for consumer and sender services:

    class Program
        static void Main(string[] args)
            Console.WriteLine("Hello World!");

            // consumer

            // you can also use extensions AddConsumersService() and AddSenderService() (in namespace JN.RabbitMQClient.Extensions)

            var consumerService = new RabbitMqConsumerService(GetBrokerConfigConsumers());

            consumerService.ReceiveMessage += ReceiveMessage;
            consumerService.ShutdownConsumer += ShutdownConsumer;
            consumerService.ReceiveMessageError += ReceiveMessageError;
            consumerService.MaxChannelsPerConnection = 5;
            consumerService.ConsumersPrefetch = 2;
            consumerService.ServiceDescription = "test consumer service";

            consumerService.StartConsumers("my consumer");
            // sender

            var senderService = new RabbitMqSenderService(GetBrokerConfigSender());

            IMessageProperties properties = new MessageProperties { Priority = 3 };

            senderService.Send("my message", properties);

            Console.WriteLine("Press any key to exit...");


        private static IBrokerConfigSender GetBrokerConfigSender()
            IBrokerConfigSender configSender = new BrokerConfigSender
                Username = "test",
                Password = "123",
                Host = hostName,
                VirtualHost = "MyVirtualHost",
                RoutingKeyOrQueueName = "MyTestQueue",
                KeepConnectionOpen = true
            return configSender;

        private static IBrokerConfigConsumers GetBrokerConfigConsumers()
            IBrokerConfigConsumers configConsumers = new BrokerConfigConsumers
                Username = "test",
                Password = "123",
                Host = hostName,
                VirtualHost = "MyVirtualHost",
                RoutingKeyOrQueueName = "MyTestQueue",
                ShuffleHostList = false,
                Port = 0,
                TotalInstances = 4
            return configConsumers;

        private static async Task ReceiveMessageError(string routingKeyOrQueueName, string consumerTag, string exchange, string message, string errorMessage)
            await Console.Out.WriteLineAsync($"Error: '{consumerTag}' | Queued message: {message} | Error message: {errorMessage}").ConfigureAwait(false);

        private static async Task ShutdownConsumer(string consumerTag, ushort errorCode, string shutdownInitiator, string errorMessage)
            await Console.Out.WriteLineAsync($"Shutdown '{consumerTag}' | {errorCode} | {shutdownInitiator} | {errorMessage}").ConfigureAwait(false);

        private static async Task<MessageProcessInstruction> ReceiveMessage(string routingKeyOrQueueName, string consumerTag, long firstErrorTimestamp, string exchange, string message, string additionalInfo, IMessageProperties properties)
            var priorityReceived = properties.Priority;

            var newPriority = (byte)(priorityReceived <= 3 ? 5 : priorityReceived);

            await Console.Out.WriteLineAsync($"Message received by '{consumerTag}' from queue '{routingKeyOrQueueName}': {message}; Priority received: {properties.Priority} ").ConfigureAwait(false);
            return new MessageProcessInstruction
                Value = Constants.MessageProcessInstruction.OK,
                Priority = newPriority,
                AdditionalInfo = "id: 123"

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
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 91 11/2/2022
2.4.3 222 7/19/2022
2.4.2 214 5/23/2022
2.4.1 199 4/20/2022
2.4.0 335 2/7/2022
2.3.4 177 12/28/2021
2.3.3 273 10/14/2021
2.3.2 219 3/17/2021
2.3.0 395 9/4/2020
2.2.1 410 6/6/2020
2.2.0-beta.1 255 5/24/2020
2.2.0-beta 225 5/15/2020
2.1.1 344 4/14/2020
2.1.0 370 12/19/2019
2.0.0 359 11/16/2019
1.0.1 409 6/30/2019
1.0.0 487 4/23/2019

   Release Notes for current version

   - Added connection timeout

Release Notes for version 2.4.3:

- Added service extensions AddConsumersService() and AddSenderService() (in namespace JN.RabbitMQClient.Extensions)
- Added ConnectionDetails readonly property
- Renamed property GetTotalConsumers to TotalConsumers
- Renamed property GetTotalRunningConsumers to TotalRunningConsumers
- Updated RabbitMQ.Client to the latest version

Release Notes for version 2.4.2:

- Update RabbitMQ.Client to latest version
- Added ConsumersPrefetch property (in consumer service)
- Bug fixes

Release Notes for version 2.4.1:

- Update RabbitMQ.Client to latest version
- Bug fixes

Release Notes for version 2.4.0:

- Added support for message properties (in sender and consumer classes); messages can now be sent for more advanced scenarios, such as queues with support for priority messages, messages Headers, etc.
- Merged sender classes; feature for keep connection open was imported to the main sender class
- Changed type for MaxChannelsPerConnection property (in consumer service)
- Bug fixes

Release Notes for version 2.3.4:

- Added support for additional information to be passed to the processing delegate; the processing instruction is now an object 'MessageProcessInstruction' where that additional information can be passed. Useful for when a message is requeued with delay to pass information to the next processing attempt.

Release Notes for version 2.3.3:

- Update target frameworks; added .NETFramework4.6.1
- Update RabbitMQ.Client to latest version
- Update consumer to expose MaxChannelsPerConnection property

Release Notes for version 2.3.2:

- Added sender service that keeps connection open.

Release Notes for version 2.3.0:

- Update RabbitMQ.Client to latest version
- Changed namespace for IRabbitMqConsumerService and IRabbitMqSenderService
- Changed behavior for StopConsumers(consumerTag) - now stops all consumers with tag starting with 'consumerTag'
- Added limiter feature for processing messages.