{"id":15039207,"url":"https://github.com/pardahlman/rawrabbit","last_synced_at":"2025-05-14T20:05:26.736Z","repository":{"id":2380907,"uuid":"44466745","full_name":"pardahlman/RawRabbit","owner":"pardahlman","description":"A modern .NET framework for communication over RabbitMq","archived":false,"fork":false,"pushed_at":"2022-12-07T16:47:48.000Z","size":1735,"stargazers_count":747,"open_issues_count":57,"forks_count":142,"subscribers_count":55,"default_branch":"2.0","last_synced_at":"2025-04-13T14:06:29.225Z","etag":null,"topics":["async","dotnetcore","message-bus","rabbitmq"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pardahlman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-18T05:26:11.000Z","updated_at":"2025-02-28T18:34:49.000Z","dependencies_parsed_at":"2023-01-13T11:49:13.795Z","dependency_job_id":null,"html_url":"https://github.com/pardahlman/RawRabbit","commit_stats":null,"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pardahlman%2FRawRabbit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pardahlman%2FRawRabbit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pardahlman%2FRawRabbit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pardahlman%2FRawRabbit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pardahlman","download_url":"https://codeload.github.com/pardahlman/RawRabbit/tar.gz/refs/heads/2.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724639,"owners_count":21151561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","dotnetcore","message-bus","rabbitmq"],"created_at":"2024-09-24T20:41:55.483Z","updated_at":"2025-04-13T14:06:36.035Z","avatar_url":"https://github.com/pardahlman.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"_Looking for documentation of 1.x? [Click here](https://github.com/pardahlman/RawRabbit/tree/stable)_\n# RawRabbit\n\n[![Build Status](https://img.shields.io/appveyor/ci/pardahlman/rawrabbit.svg?style=flat-square)](https://ci.appveyor.com/project/pardahlman/rawrabbit) [![Documentation Status](https://readthedocs.org/projects/rawrabbit/badge/?version=latest\u0026style=flat-square)](http://rawrabbit.readthedocs.org/) [![NuGet](https://img.shields.io/nuget/v/RawRabbit.svg?style=flat-square)](https://www.nuget.org/packages/RawRabbit) [![GitHub release](https://img.shields.io/github/release/pardahlman/rawrabbit.svg?style=flat-square)](https://github.com/pardahlman/rawrabbit/releases/latest)\n[![Slack Status](https://rawrabbit.herokuapp.com/badge.svg)](https://rawrabbit.herokuapp.com)\n\n## Quick introduction\n`RawRabbit` is a modern .NET framework for communication over [RabbitMQ](http://rabbitmq.com/). The modular design and middleware oriented architecture makes the client highly customizable while providing sensible default for topology, routing and more. Documentation for version 2.x of the is currently found under [`/docs`](https://github.com/pardahlman/RawRabbit/tree/2.0/docs).\n\n### Configure, enrich and extend\n\n`RawRabbit` is configured with `RawRabbitOptions`, an options object that makes it possible to register client configuration, plugins as well as override internal services\n\n```csharp\nvar client = RawRabbitFactory.CreateSingleton(new RawRabbitOptions\n{\n  ClientConfiguration = new ConfigurationBuilder()\n    .SetBasePath(Directory.GetCurrentDirectory())\n    .AddJsonFile(\"rawrabbit.json\")\n    .Build()\n    .Get\u003cRawRabbitConfiguration\u003e(),\n  Plugins = p =\u003e p\n    .UseProtobuf()\n    .UsePolly(c =\u003e c\n        .UsePolicy(queueBindPolicy, PolicyKeys.QueueBind)\n        .UsePolicy(queueDeclarePolicy, PolicyKeys.QueueDeclare)\n        .UsePolicy(exchangeDeclarePolicy, PolicyKeys.ExchangeDeclare)\n    ),\n  DependencyInjection = ioc =\u003e ioc\n    .AddSingleton\u003cIChannelFactory, CustomChannelFactory\u003e()\n});\n```\n\n### Publish/Subscribe\nSet up strongly typed publish/subscribe in just a few lines of code.\n\n```csharp\nvar client = RawRabbitFactory.CreateSingleton();\nawait client.SubscribeAsync\u003cBasicMessage\u003e(async msg =\u003e\n{\n  Console.WriteLine($\"Received: {msg.Prop}.\");\n});\n\nawait client.PublishAsync(new BasicMessage { Prop = \"Hello, world!\"});\n```\n\n### Request/Response\n`RawRabbits` request/response (`RPC`) implementation uses the [direct reply-to feature](https://www.rabbitmq.com/direct-reply-to.html) for better performance and lower resource allocation.\n\n```csharp\nvar client = RawRabbitFactory.CreateSingleton();\nclient.RespondAsync\u003cBasicRequest, BasicResponse\u003e(async request =\u003e\n{\n  return new BasicResponse();\n});\n\nvar response = await client.RequestAsync\u003cBasicRequest, BasicResponse\u003e();\n```\n\n### Ack, Nack, Reject and Retry\n\nUnlike many other clients, `basic.ack`, `basic.nack` and `basic.reject` are first class citizen in the message handler\n\n```csharp\nvar client = RawRabbitFactory.CreateSingleton();\nawait client.SubscribeAsync\u003cBasicMessage\u003e(async msg =\u003e\n{\n  if(UnableToProcessMessage(msg))\n  {\n    return new Nack(requeue: true);\n  }\n  ProcessMessage(msg)\n  return new Ack();\n});\n```\n\nIn addition to the basic acknowledgements, RawRabbit also support delayed retries\n\n```csharp\nvar client = RawRabbitFactory.CreateSingleton();\nawait client.SubscribeAsync\u003cBasicMessage\u003e(async msg =\u003e\n{\n  try\n  {\n    ProcessMessage(msg)\n    return new Ack();\n  }\n  catch (Exception e)\n  {\n    return Retry.In(TimeSpan.FromSeconds(30));\n  }\n});\n```\n\n### Granular control for each call\n\nAdd or change properties in the `IPipeContext` to tailor calls for specific type of messages. This makes it possible to modifly the topology features for calls, publish confirm timeout, consumer concurrency and much more\n\n```csharp\nawait subscriber.SubscribeAsync\u003cBasicMessage\u003e(received =\u003e\n{\n  receivedTcs.TrySetResult(received);\n  return Task.FromResult(true);\n}, ctx =\u003e ctx\n  .UseSubscribeConfiguration(cfg =\u003e cfg\n    .Consume(c =\u003e c\n      .WithRoutingKey(\"custom_key\")\n      .WithConsumerTag(\"custom_tag\")\n      .WithPrefetchCount(2)\n      .WithNoLocal(false))\n    .FromDeclaredQueue(q =\u003e q\n      .WithName(\"custom_queue\")\n      .WithAutoDelete()\n      .WithArgument(QueueArgument.DeadLetterExchange, \"dlx\"))\n    .OnDeclaredExchange(e=\u003e e\n      .WithName(\"custom_exchange\")\n      .WithType(ExchangeType.Topic))\n));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpardahlman%2Frawrabbit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpardahlman%2Frawrabbit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpardahlman%2Frawrabbit/lists"}