Skip to content

refactor: remove consumersOnly parameter from Load method and update … - #37

Merged
mmalkhatib merged 1 commit into
mainfrom
fix/consumer-discovery-include-generic-consumers
May 17, 2026
Merged

refactor: remove consumersOnly parameter from Load method and update …#37
mmalkhatib merged 1 commit into
mainfrom
fix/consumer-discovery-include-generic-consumers

Conversation

@hamzahalq

@hamzahalq hamzahalq commented May 17, 2026

Copy link
Copy Markdown
Contributor

…related calls

Summary by CodeRabbit

  • Refactor
    • Updated internal consumer definition loading mechanisms to streamline how consumer topology is retrieved across the system.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: df99a675-e180-4dd2-87c6-1430371f063e

📥 Commits

Reviewing files that changed from the base of the PR and between 6966bf3 and 7ae53b1.

📒 Files selected for processing (4)
  • SW.Bus/ConsumerDiscovery.cs
  • SW.Bus/ConsumerReader.cs
  • SW.Bus/ConsumersService.cs
  • SW.Bus/ErrorQueueReader.cs

📝 Walkthrough

Walkthrough

This PR simplifies consumer definition loading by removing the optional consumersOnly parameter from ConsumerDiscovery.Load() and updating all four call sites to use the uniform parameterless method. The change ensures generic consumer definitions are always collected, removing conditional branching logic.

Changes

Consumer Discovery Load Simplification

Layer / File(s) Summary
ConsumerDiscovery Load signature and control flow
SW.Bus/ConsumerDiscovery.cs
Load() method signature changed from Load(bool consumersOnly = false) to parameterless. The early-return branch (if (consumersOnly) return consumerDefinitions;) is removed, so the method unconditionally proceeds to collect and add generic consumer definitions before returning.
ConsumerReader consumer count methods and caching
SW.Bus/ConsumerReader.cs
Four consumer-count retrieval methods (GetConsumerCount<TConsumer>(), GetConsumerCount<TTypedConsumer, TMessage>(), GetAllConsumersCount()) switch from Load(true) to Load(). Constructor parameter formatting and lastUpdatedUtc field documentation adjustments accompany the functional updates. Cached queue-fetch paths retain their update timing and conditional behavior.
ConsumersService RefreshConsumers load call
SW.Bus/ConsumersService.cs
RefreshConsumers() updates its consumer discovery call from Load(true) to Load(), aligning refresh logic with the unified loading behavior.
ErrorQueueReader Peek methods and error queue resolution
SW.Bus/ErrorQueueReader.cs
PeekInternal() switches from Load(true) to Load() when selecting the target error queue definition. Public Peek() overload declarations are reformatted, and exception message whitespace is adjusted. Guard clause and core queue selection logic remain unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • simplify9/SW-Bus#21: Introduced the consumersOnly parameter and early-return logic that this PR removes.
  • simplify9/SW-Bus#27: Added consumer statistics reading via ConsumerReader, which this PR updates with the new unified Load() behavior.
  • simplify9/SW-Bus#36: Modifies ConsumerDiscovery.Load deduplication logic that works alongside this signature and control-flow simplification.

Suggested reviewers

  • mmalkhatib
  • samerzughul

Poem

🐰 A parameter fades, a branch melts away,
All consumers now load the unified way,
No more true whispers through the call stack's dance,
Just Load() called simple—a cleaner romance!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/consumer-discovery-include-generic-consumers

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.

@mmalkhatib
mmalkhatib merged commit f45e6c6 into main May 17, 2026
1 of 2 checks passed
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