Skip to content

Muhannad/dynamic consumer props - #21

Merged
samerzughul merged 4 commits into
mainfrom
muhannad/dynamic-consumer-props
Dec 30, 2025
Merged

Muhannad/dynamic consumer props#21
samerzughul merged 4 commits into
mainfrom
muhannad/dynamic-consumer-props

Conversation

@mmalkhatib

@mmalkhatib mmalkhatib commented Dec 30, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added priority-based message publishing with configurable default max priority
    • Introduced consumer configuration options including prefetch, priority, and retry settings
    • Extended consumer interface to support enhanced configuration capabilities
  • Refactor

    • Restructured consumer discovery and service lifecycle for improved asynchronous handling
    • Reorganized queue and consumer options into dedicated extension library

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Dec 30, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

A new RabbitMqExtensions library is introduced with consumer and queue configuration types. The main SW.Bus project is refactored to depend on it, adding priority-based publishing support and enhanced consumer discovery with extended configuration options. The build workflow and solution file are updated to include the new library.

Changes

Cohort / File(s) Summary
NuGet & Build Configuration
.github/workflows/nuget-publish.yml, SW.Bus.sln, SW.Bus/SW.Bus.csproj, SW.Bus.RabbitMqExtensions/SW.Bus.RabbitMqExtensions.csproj
NuGet publish workflow expanded to include new RabbitMqExtensions project; new project added to solution with full build mappings; SW.Bus project updated to reference new library via ProjectReference and remove PrimitiveTypes dependency.
New RabbitMqExtensions Library
SW.Bus.RabbitMqExtensions/ConsumerOptions.cs, SW.Bus.RabbitMqExtensions/QueueOptions.cs, SW.Bus.RabbitMqExtensions/IConsumeExtended.cs
New library with ConsumerOptions class (Prefetch, Priority properties), QueueOptions extending ConsumerOptions (adds RetryCount, RetryAfterSeconds, ConsumerArgs computed property), and IConsumeExtended interface extending IConsume with GetMessageTypeNamesWithOptions method.
Publisher Priority Support
SW.Bus/BasicPublisher.cs
Three Publish overloads augmented with optional byte? priority parameter; priority value propagated to underlying message properties.
Bus Configuration
SW.Bus/BusOptions.cs
Added public DefaultMaxPriority property (int); added using directive for RabbitMqExtensions namespace.
Consumer Type Definitions
SW.Bus/ConsumerDefinition.cs
Significant expansion: new constructor accepting ConsumerOptions; added private fields for queueNamePrefix, busOptions, queueOptions; new public properties (RetryArgs, ProcessArgs, ConsumerArgs, ConsumerPriority, ConsumerTag, ConsumerObject); RetryArgs and ProcessArgs now computed with dead-letter exchange/routing-key mappings.
Consumer Discovery & Registration
SW.Bus/ConsumerDiscovery.cs, SW.Bus/IServiceCollectionExtensions.cs
ConsumerDiscovery refactored to primary constructor; new async Load(consumersOnly) method supporting IConsumeExtended, IConsume, and generic IConsumeGenericBase variants; new LoadListeners() method for listener discovery; IServiceCollectionExtensions updated to register IConsumeExtended implementations.
Consumer Lifecycle Management
SW.Bus/ConsumersService.cs, SW.Bus/ConsumerRunner.cs
ConsumersService completely refactored with dependency injection, connection lifecycle handling, async StartAsync/StopAsync methods, DeclareAndBind helpers, dynamic consumer attachment and refresh; ConsumerRunner exception handling simplified to unnamed catch block.
Dependency Version Bump
SW.Bus.SampleWeb/SW.Bus.SampleWeb.csproj
SimplyWorks.PrimitiveTypes bumped from 6.0.5 to 8.1.2.
Namespace Cleanup
SW.Bus/Publisher.cs
Removed unused using directives (System.Collections.Generic, System.Security.Claims, System.Text, SW.HttpExtensions); added SW.Bus.RabbitMqExtensions.
Removed Legacy Type
SW.Bus/QueueOptions.cs
Public QueueOptions class removed entirely; functionality migrated to new SW.Bus.RabbitMqExtensions.QueueOptions.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 A new warren emerges, with options so fine,
Priority whispers through queues in a line,
Discovery awakens to patterns anew,
Consumers find refuge in structures that grew.
Our buses now bloom with configuration's sweet art! 🌱✨

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a61b58e and e863f3c.

📒 Files selected for processing (17)
  • .github/workflows/nuget-publish.yml
  • SW.Bus.RabbitMqExtensions/ConsumerOptions.cs
  • SW.Bus.RabbitMqExtensions/IConsumeExtended.cs
  • SW.Bus.RabbitMqExtensions/QueueOptions.cs
  • SW.Bus.RabbitMqExtensions/SW.Bus.RabbitMqExtensions.csproj
  • SW.Bus.SampleWeb/SW.Bus.SampleWeb.csproj
  • SW.Bus.sln
  • SW.Bus/BasicPublisher.cs
  • SW.Bus/BusOptions.cs
  • SW.Bus/ConsumerDefinition.cs
  • SW.Bus/ConsumerDiscovery.cs
  • SW.Bus/ConsumerRunner.cs
  • SW.Bus/ConsumersService.cs
  • SW.Bus/IServiceCollectionExtensions.cs
  • SW.Bus/Publisher.cs
  • SW.Bus/QueueOptions.cs
  • SW.Bus/SW.Bus.csproj

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants