Skip to content

feat: accept Redis and NATS destination objects in broker methods - #3311

Draft
DMINQ wants to merge 3 commits into
ag2ai:mainfrom
DMINQ:feat/3305-redis-subscription-destinations
Draft

DMINQ wants to merge 3 commits into
ag2ai:mainfrom
DMINQ:feat/3305-redis-subscription-destinations

Conversation

@DMINQ

@DMINQ DMINQ commented Oct 30, 2026 •

Copy link
Copy Markdown

Description

Accept reusable destination objects in broker methods while preserving
existing string arguments.

Redis:

  • PubSub in publish and request.
  • ListSub in publish, request, and publish_batch.
  • StreamSub in publish and request.
  • Inherit StreamSub.maxlen when maxlen is None; explicit values,
    including 0, take precedence.

NATS:

  • Accept JStream in NatsBroker.publish and NatsBroker.request.
  • Normalize it to its name before producer selection and middleware execution.
  • Keep the target subject as a separate argument.

Sending does not modify the supplied objects. Includes updated typing,
tests, and documentation.

Fixes #3305.

Type of change

  • New feature (a non-breaking change that adds functionality)
  • Documentation update

Validation

  • 19 tests passed against real Redis and NATS, covering request/reply,
    publishing, PubAck, batch publishing, and Redis pipelines.
  • 205 tests passed without broker connections, including documentation examples.
  • Ruff formatting and lint checks passed.
  • Mypy, Pyright, and Pyrefly passed.
  • Documentation built successfully; 152 pages checked.

@github-actions github-actions Bot added documentation Improvements or additions to documentation Redis Issues related to `faststream.redis` module and Redis features labels Oct 30, 2026
@github-actions github-actions Bot added the NATS Issues related to `faststream.nats` module and NATS broker features label Oct 31, 2026
@DMINQ DMINQ changed the title feat(redis): accept subscription objects as destinations feat: accept Redis and NATS destination objects in broker methods Oct 31, 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

documentation Improvements or additions to documentation NATS Issues related to `faststream.nats` module and NATS broker features Redis Issues related to `faststream.redis` module and Redis features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: accept Redis subscription objects in publish, request, and publish_batch

1 participant