Skip to content

Add slow consumer docs#1073

Merged
mtmk merged 1 commit into
mainfrom
add-slow-consumer-docs
Feb 24, 2026
Merged

Add slow consumer docs#1073
mtmk merged 1 commit into
mainfrom
add-slow-consumer-docs

Conversation

@mtmk

@mtmk mtmk commented Feb 20, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive documentation for handling slow consumers in NATS.Net, explaining how to detect and respond to situations where subscribers cannot keep up with the message rate. The documentation covers detection mechanisms, channel capacity tuning, and backpressure options.

Changes:

  • Added new "Slow Consumers" documentation page with examples for detecting dropped messages, slow consumer episodes, tuning channel capacity, and suppressing warnings
  • Updated the advanced section table of contents and intro to include the new slow consumers documentation
  • Added comprehensive code examples demonstrating slow consumer handling APIs

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tools/site_src/documentation/toc.yml Adds "Slow Consumers" entry to the advanced topics navigation
tools/site_src/documentation/advanced/slow-consumers.md New documentation page covering slow consumer detection, channel tuning, and warning suppression
tools/site_src/documentation/advanced/intro.md Adds reference to the new slow consumers documentation in the "What's Next" section
tests/NATS.Net.DocsExamples/Advanced/SlowConsumerPage.cs Provides working code examples for all slow consumer scenarios documented in the markdown file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +28 to +31
The `SubPendingChannelFullMode` option controls what happens when the channel is full:

- `BoundedChannelFullMode.DropNewest` (default for `NatsConnection`) - newest messages are dropped
- `BoundedChannelFullMode.Wait` (default for `NatsClient`) - backpressure is applied, but the server may disconnect you as a slow consumer

Copilot AI Feb 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation states that BoundedChannelFullMode.DropNewest is the "default for NatsConnection" and BoundedChannelFullMode.Wait is the "default for NatsClient". While technically accurate, this could be misleading because NatsClient is a higher-level wrapper that modifies the NatsOpts.SubPendingChannelFullMode from its base default.

Consider clarifying that BoundedChannelFullMode.DropNewest is the default for the underlying NatsOpts, which NatsConnection uses directly, while NatsClient explicitly overrides this to use BoundedChannelFullMode.Wait. This would make it clearer that the difference is due to NatsClient being an opinionated wrapper rather than two separate default configurations.

Suggested change
The `SubPendingChannelFullMode` option controls what happens when the channel is full:
- `BoundedChannelFullMode.DropNewest` (default for `NatsConnection`) - newest messages are dropped
- `BoundedChannelFullMode.Wait` (default for `NatsClient`) - backpressure is applied, but the server may disconnect you as a slow consumer
The `SubPendingChannelFullMode` option controls what happens when the channel is full.
The base default is defined on `NatsOpts` (used directly by `NatsConnection`), while `NatsClient` is a higher-level, opinionated wrapper that overrides this default:
- `BoundedChannelFullMode.DropNewest` (default on `NatsOpts` / `NatsConnection`) - newest messages are dropped
- `BoundedChannelFullMode.Wait` (default when using `NatsClient`, which overrides `SubPendingChannelFullMode`) - backpressure is applied, but the server may disconnect you as a slow consumer

Copilot uses AI. Check for mistakes.

@scottf scottf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mtmk
mtmk merged commit 31e500d into main Feb 24, 2026
23 of 26 checks passed
@mtmk
mtmk deleted the add-slow-consumer-docs branch February 24, 2026 12:44
mtmk added a commit that referenced this pull request Mar 13, 2026
* Add optional window_size parameter to StreamSnapshotRequest (#1088)
* Bump Microsoft.Bcl.Memory from 9.0.0 to 9.0.14 (#1089)
* Fix `PingCommand` cancellation (#1086)
* rework terminate reason (#1081)
* Fix OTel network telemetry tags (#1078)
* Add consumer info usage warnings (#1079)
* Add TermWithReason support to AckTerminateAsync (#1048)
* Fix code analyser warning (#1076)
* Add cancelled token handling for consumers (#1068)
* Add validation for unsupported PinnedClient calls (#1063)
* Add see-also references to Orbit packages (#1077)
* Add Synadia.Orbit.Testing.NatsServerProcessManager (#1065)
* Add slow consumer docs (#1073)
* Fix error logs URI rewritten by OnConnectingAsync (#1067)
* Add more tests for JetStream consumer behavior (#1055)
@mtmk mtmk mentioned this pull request Mar 13, 2026
mtmk added a commit that referenced this pull request Mar 13, 2026
* Add optional window_size parameter to StreamSnapshotRequest (#1088)
* Bump Microsoft.Bcl.Memory from 9.0.0 to 9.0.14 (#1089)
* Fix `PingCommand` cancellation (#1086)
* rework terminate reason (#1081)
* Fix OTel network telemetry tags (#1078)
* Add consumer info usage warnings (#1079)
* Add TermWithReason support to AckTerminateAsync (#1048)
* Fix code analyser warning (#1076)
* Add cancelled token handling for consumers (#1068)
* Add validation for unsupported PinnedClient calls (#1063)
* Add see-also references to Orbit packages (#1077)
* Add Synadia.Orbit.Testing.NatsServerProcessManager (#1065)
* Add slow consumer docs (#1073)
* Fix error logs URI rewritten by OnConnectingAsync (#1067)
* Add more tests for JetStream consumer behavior (#1055)
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.

3 participants