Skip to content

Support queued subscribers with CapturingSubscribableBus#186

Merged
condron merged 1 commit into
masterfrom
joshkempner/single-threaded-bus
Mar 19, 2026
Merged

Support queued subscribers with CapturingSubscribableBus#186
condron merged 1 commit into
masterfrom
joshkempner/single-threaded-bus

Conversation

@joshkempner
Copy link
Copy Markdown
Contributor

What does this pull request do?
The CapturingSubscribableBus returns from Send before the command has been handled if the subscriber uses an internal queue for its subscriptions. This breaks the blocking paradigm of Send that is intended for tests under the capturing bus.

How does this pull request accomplish that goal?

  • Implements a SingleThreadedBus to support unit tests.
  • Uses that bus as the internal bus in CapturingSubscribableBus, along with additional logic to deal with queued handling of commands.
  • Adds tests for CapturingSubscribableBus to cover both synchronous handling and queued handling of commands.

Why is this pull request important?
Tests of services that use, e.g. a QueuedSubscriber would need to implement additional logic similar to WaitFor unless Send and its variants block until the command is handled.

Link to any issues that this resolves
This does not address any open issues.

Checklist

  • All unit tests in the solution must pass on all versions of .NET that the solution supports
  • Any new code must be covered by at least one unit test
  • All public methods must be documented with XML comments

- Implements a `SingleThreadedBus` to support unit tests.
- Uses that bus as the internal bus in `CapturingSubscribableBus`, along with additional logic to deal with queued handling of commands.
- Adds tests for `CapturingSubscribableBus` to cover both synchronous handling and queued handling of commands.
@joshkempner joshkempner requested a review from condron March 19, 2026 13:55
@joshkempner joshkempner self-assigned this Mar 19, 2026
@joshkempner joshkempner requested a review from a team as a code owner March 19, 2026 13:55
@condron condron merged commit c3a393c into master Mar 19, 2026
2 checks passed
@condron condron deleted the joshkempner/single-threaded-bus branch March 19, 2026 14:36
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