CookedRabbit is a simple service based RabbitMQ wrapper for dealing with channels/connections.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 61e3cbd Nov 9, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
BenchmarkResults Medium Patch. Oct 7, 2018
CookedRabbit.Demo Updating NuGets. Nov 8, 2018
CookedRabbit.Tests Updating NuGets. Nov 8, 2018
CookedRabbit Updating NuGets. Nov 8, 2018
NetCore Updating NuGets. Nov 8, 2018
.gitattributes Add .gitignore and .gitattributes. Jun 8, 2018
.gitignore NuGet fixes Jun 30, 2018
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Oct 2, 2018
CookedRabbit.sln Medium Patch. Oct 7, 2018
LICENSE Create LICENSE Jul 7, 2018
README.md Update README.md Oct 10, 2018
icon.png Add files via upload Jul 22, 2018

README.md

CookedRabbit AppVeyor

.NET 4.7.2 NuGet NuGet

NetCore 2.1 NuGet NuGet

Development Changes: Branch Management!

Click to show!

The goal here is to make development not piss off other devs. You need to get a tagged/release - they will be stored. I know how difficult it is dealing with developers making radical changes between releases. So - I got you. Also, should something stupid sneak into release, master can now be patched to cut a minor release build without having to include experimental/development features.

  • Starting v1.0.1.0 (v1.0.1), we will be creating & tagging releases.
  • All future development work will go into develop branch.
  • NuGets will release slower (after merging into master from develop) but you can always pull develop yourself.

Rename Notice: As of 9/9/2018, Projects were renamed to remove .Library suffix.

Click to show!

  • CookedRabbit.Library changed to CookedRabbit.
  • CookedRabbit.Core.Library changed to CookedRabbit.Core
  • CookedRabbit.Library and CookedRabbit.Core.Library v 1.0.0.20 have been delisted from NuGet.
  • The name change applies to internal code and namespaces too.
    • You will have to update your code moving to v1.0.0.21+ and remove keyword 'Library'.
  • Documentation has not been fully updated (yet).

Welcome!

About CookedRabbit

CookedRabbit is a simple RabbitMQ wrapper for dealing with channels and connection headaches. It also shows you the natural evolution to common everyday problems with RabbitMQ implementations and how to avoid them. This solution is more orientated to services.

This is RabbitMQ as a Service with lightweight dazzle : RaaS L dazzle

The Demo client begins with examples that you should avoid and slowly progresses to more advanced concepts. The biggest problem I have observed so far is the storing of IModels (RabbitMQ object that represents channels) in containers/collections. This makes code very prone to memory leaks. After observing it countless times, I thought it would make a great candidate for abstraction. The examples are supposed to be simplistic.

This library is not supposed to be rocket science. It should demonstrate simplification, removal, and abstraction of common usage code when wrapping RabbitMQ DotNetClient. It continues to add functionality with simplification at the same time. I recommend getting started with the CookedRabbit wiki examples.

Inspired by the likes of RawRabbit (https://github.com/pardahlman/RawRabbit), I needed a simpler RabbitMQ solution at times for specific situations. The longterm goal is to be modern, lightweight, and KISS. If you need a more thorough/advanced solution, I highly recommend checking out aforementioned RawRabbit or another popular solution: EastyNetQ.

For more details and code examples, visit the Wiki!

Why use CookedRabbit?

Click to show!

I personally would use CookedRabbit because it is simple. Once you are setup with a ChannelPool, you are ready to just Publish and/or Get through a service or RabbitBurrow if you prefer. Obviously it's capable of more but it is entirely optional. One bonus advantage to CookedRabbit is that I will stay current with .Net Framework, NetCore, C#7.x+, and the RabbitMQ client. It is not my intention to let things lag behind Pivotal RabbitMQ or Microsoft releases.

  • CookedRabbit is in active development.
  • CookedRabbit supports SSL/TLS.
  • CookedRabbit supports Gzip, Deflate, and LZ4 compression.
  • CookedRabbit supports Utf8Json, ZeroFormat, and JSON string serialization.
  • CookedRabbit provides async/await around RabbitMQ calls.
  • CookedRabbit is Dependency Injection friendly.
  • CookedRabbit services support an optional ILogger from Microsoft.Extensions.Logger.
  • CookedRabbit supports logic based customizations.
  • CookedRabbit has fairly decent commenting and Wiki being filled out.
  • CookedRabbit has a plethora of examples on how to use in the Demo project, Tests project, and Benchmark project.

Last words on this library: it is far from perfect. I am always trying to improve performance but maintain scalability. An overclocker will readily tell you something is always the bottleneck but I tried to blend the software ones as much as possible. Occasionally, you will see something that doesn't quite look like best practices. I am always willing to change and learn - but in some cases, best practices don't work the fastest.

With that being said, here is some sample performance!

Test Setup

i7 8700K @ 4.7 GHz, Samsung Evo Pro 600 512 GB m2 NVMe
100,000 messages (1KB each.) Distributed over 10 queues and a 10 connection/30 channel pool.
RabbitMQ Server v3.7.8 (localhost)
Erlang v21.1
NetCore v2.0.4 / x64 / Release
0 Errors/0 Lost

RabbitMQ 5.10+ - BasicBatch

Summary: Recently added by Pivotal .NET team. Looks like a good performer but believe the library has an unusally long delay getting to the server. The results took an additional second or two to show up server side (validation counts), which means it is probably queued up client side somewhat.
Channel: Uses one channel and some client side buffer.

That means these benchmark numbers are the rate of sending to the client side library queue buffer - not 100% to the actual server.

RabbitMQ 5.10+ - BasicBatch (with async Task Wrapper)

Summary: Not a major performance hit from wrapping in a Task.Run, which is good and allows it to be called asynchronously.
Channel: Uses one channel and some client side buffer.

PublishInParallel - Multi (Concurrent)

Summary: Not designed to be ran concurrently with others as it uses a channel per publish make this heavy on network connectivity between Server and RabbitMQ node. Use this when connection pools are large and network conditions are stellar.
Channel Usage: Psychotic.

PublishInParallel - Single

Summary: Same as above but only one method is used to publish 100,000 messages. Subject to IConnectionPool overhead.
Channel Usage: 100%.

PublishMany - Single Async

Summary: Same as above, one method publishes all messages using asynchronous flow.
Channel Usage: Only 1.

PublishMany - Single

Summary: Same as above, one method publishes all messages using synchronous flow.
Channel Usage: Only 1.

PublishMany - Multi

Summary: 10 PublishMany single methods fired sequentially.
Channel Usage: Only 1 at a time, new channel at the start of each method.

PublishMany - Multi Async/Concurrent

Summary: 10 PublishMany single methods fired async/concurrently.
Channel Usage: 10 channels engaged at the same time.

Getting Started

Click to show!

Configuring RabbitMQ Server First (if running Local)

To run .Demo locally, have Erlang 20.3 and Server RabbitMQ v3.7.x installed locally and running first.
Use the HTTP API management from RabbitMQ to verify communication is occurring.
The Demo project calls WarmupAsync() will create the queue '001' to work with, if it doesn't exist, and send/receive a test messages.

Developed/Tested On

  • Erlang 20.3 (pre-9/29/2018)
  • Erlang 21.1 (post-9/29/208)
  • RabbitMQ Server v3.7.5 (pre-7/6/2018)
  • RabbitMQ Server v3.7.7 (pre-9/29/2018)
  • RabbitMQ Server v3.7.8 (post-9/29/2018)

Configuration Values

Checkout the RabbitSeasoning to configure your RabbitService/RabbitTopologyService.

NetFramework Requirements

Click to show!

  • Visual Studio 2017+ installed (Community+).
  • .NET 4.7.2 SDK installed.
  • Compile as C# 7.2+ minimum.

NetCore Requirements

Click to show!

  • Visual Studio Code or Visual Studio 2017+ installed.
  • Open Folder NetCore or open the SLN.
  • Compile as C# 7.2+ minimum.
  • NetCore 2.1.0 SDK installed.

Note: (NetCore runtime 2.1.1 seems buggy at this time)

Documentation

Click to show!

  • Visit the Wiki!
    • Check out the changelog for detailed changes made via commit.
    • Check out the Library Documentation for class/variable/service descriptions and comments.
    • Check out the Library Tutorial section for basic how-tos.

Upcoming Features

Click to show!

  • Adding a built-in Polly Plugin implementation.
  • Custom Connection model with EventListener wireups.
  • Disaster recovery & circuit break.
  • A ServiceBus-esque client.
  • Additional Demonstrations.

Service Topology At A Glance

Click to show ASCII Art!

    ║
    ║ Your Business Logic
    ║
    ╠══ » RabbbitBurrow ════════════════════════════════════════════════════════════╗
    ║       ║                                                                       ║
    ║       ║ & RabbitSerializeService : RabbitDeliveryService                      ║
    ║       ║ & RabbitMaintenanceService : RabbitTopologyService                    ║
    ║       ║ - Circuit Breaker                                                     ║
    ║       ║ - Abstraction                                                         ║
    ║       ║                                                                       ║
    ╠════ » ╠══ » RabbitDeliveryService : IRabbitDeliveryService ═══════════════════╣
    ║       ║       ║                                                               ║
    ║       ║       ║ & RabbitChannelPool                                           ║
    ║       ║       ║ & RabbitSeasoning                                             ║
    ║       ║       ║                                                               ║
    ║       ║       ║ + Flag Channel As Dead                                        ║
    ║       ║       ║ + Return Channel To Pool (Finished Work)                      ║
    ║       ║       ║                                                               ║
    ║       ║       ║ + Publish                                                     ║
    ║       ║       ║ + PublishMany                                                 ║
    ║       ║       ║ + PublishManyAsBatches                                        ║
    ║       ║       ║                                                               ║
    ║       ║       ║ + Get                                                         ║
    ║       ║       ║   + Returns As ValueTuple                                     ║
    ║       ║       ║   + Returns As AckableResult                                  ║
    ║       ║       ║ + GetMany                                                     ║
    ║       ║       ║   + Returns As ValueTuple                                     ║
    ║       ║       ║   + Returns As AckableResult                                  ║
    ║       ║       ║                                                               ║
    ║       ║       ║ + CreateConsumerAsync                                         ║
    ║       ║       ║ + CreateAsyncConsumerAsync                                    ║
    ║       ║       ║                                                               ║
    ║       ║       ║ Customize:                                                    ║
    ║       ║       ║ + Use ILogger                                                 ║
    ║       ║       ║ + throw ex                                                    ║
    ║       ║       ║ + Throttling                                                  ║
    ║       ║       ║                                                               ║
    ║       ║       ╚══ » RabbitChannelPool : IRabbitChannelPool ═══════════════════╣
    ║       ║               ║                                                       ║
    ║       ║               ║ & RabbitConnectionPool                                ║
    ║       ║               ║ & RabbitSeasoning                                     ║
    ║       ║               ║                                                       ║
    ║       ║               ║ + GetTransientChannel (non-Ackable)                   ║
    ║       ║               ║ + GetTransientChannel (Ackable)                       ║
    ║       ║               ║                                                       ║
    ║       ║               ║ + GetChannelPair from &ChannelPool (non-Ackable)      ║
    ║       ║               ║ + GetChannelPair from &ChannelPool (ackable)          ║
    ║       ║               ║                                                       ║
    ║       ║               ║ Mechanisms:                                           ║
    ║       ║               ║ + Get Channel Delay (When All Channels Are In Use)    ║
    ║       ║               ║ + In Use ChannelPair Pool                             ║
    ║       ║               ║ + In Use Ack ChannelPair Pool                         ║
    ║       ║               ║ + Return Channel to A Pool                            ║
    ║       ║               ║                                                       ║
    ║       ║               ║ Customize:                                            ║
    ║       ║               ║ - Use ILogger                                         ║
    ║       ║               ║ - throw ex                                            ║
    ║       ║               ║                                                       ║
    ║       ║               ╚══ » RabbitConnectionPool : IRabbitConnectionPool ═════╣
    ║       ║                       ║                                               ║
    ║       ║                       ║ & RabbitMQ ConnectionFactory                  ║
    ║       ║                       ║ & RabbitSeasoning                             ║
    ║       ║                       ║ & ConnectionPool                              ║
    ║       ║                       ║                                               ║
    ║       ║                       ║ Customize:                                    ║
    ║       ║                       ║ - Use ILogger                                 ║
    ║       ║                       ║ - throw ex                                    ║
    ║       ║                       ║ - System for Dealing with Flagged Connections ║
    ║       ║                       ║                                               ║
    ║       ║                       ╚═══════════════════════════════════════════════╣
    ║       ║                                                                       ║
    ╚═══════╚═══════════════════════════════════════════════════════════════════════╝

To be continued on the wiki!

Legend

& Indicates mandatory/crucial internal object.  
+ Exists (or exists with future enhancements)  
- Does not exist yet.  
! Important  

HouseofCat.io