Add slow consumer docs#1073
Conversation
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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.
| 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 |
* 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)
* 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)
No description provided.