Skip to content

Support pull-specific limits in ConsumerConfig - #1128

Open
lazypanic999 wants to merge 1 commit into
nats-io:mainfrom
lazypanic999:feat/pull-consumer-limits-676
Open

lazypanic999 wants to merge 1 commit into
nats-io:mainfrom
lazypanic999:feat/pull-consumer-limits-676

Conversation

@lazypanic999

@lazypanic999 lazypanic999 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

ConsumerConfig currently rejects max_batch, max_expires, and max_bytes constructor arguments and discards these fields when reading consumer information. This prevents the legacy client from configuring the server's pull-specific request limits.

Add the three optional fields, with max_expires expressed in seconds and converted to/from the server's integer nanoseconds. Unset fields stay omitted and explicit zero values are preserved. The fields are appended to retain the existing positional argument order. Include a usage example in the package README.

Fixes #676.

Validation:

  • Nine configuration cases cover serialization, parsing, fractional durations, omitted/null fields, defaults, and explicit zeros.
  • A live-server test checks all three returned settings, rejection of each oversized request, and successful delivery within the limits.
  • On Python 3.12.3 / Ubuntu (WSL), the new tests plus the existing API dataclass and pull-subscription suites pass: 44 tests and 3 subtests, using nats-server 2.15.3. No test-helper adaptations are needed on Linux.
  • The ten focused cases also pass on Python 3.13.1 / Windows with nats-server 2.15.3, using an external local runner that maps the existing helper's POSIX-only SIGKILL to SIGTERM. No helper changes are included.
  • Repository ruff lint, format, and spelling checks pass. The nats-py sdist and wheel build successfully.
  • CI-scoped typing with the Linux target exits successfully with four existing warnings in unchanged nats-core files.

Implementation and tests prepared with OpenAI Codex assistance; validation was executed locally.

@lazypanic999
lazypanic999 marked this pull request as ready for review November 20, 2026 19:35
@caspervonb caspervonb added the nats-legacy Legacy asyncio NATS client label Nov 24, 2026

This branch has not been deployed

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

Labels

nats-legacy Legacy asyncio NATS client

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support JetStream pull-specific consumer configuration

2 participants