Skip to content

Commit

Permalink
Update subscriber signature for Router and FastAPI integration
Browse files Browse the repository at this point in the history
  • Loading branch information
sheldygg committed May 18, 2024
1 parent 4a0325b commit aa5c2a7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion faststream/nats/fastapi/fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
SubscriberMiddleware,
)
from faststream.nats.message import NatsBatchMessage, NatsMessage
from faststream.nats.schemas import JStream, PullSub
from faststream.nats.schemas import JStream, PullSub, KvWatch, ObjWatch
from faststream.security import BaseSecurity
from faststream.types import AnyDict, LoggerProto

Expand Down Expand Up @@ -651,6 +651,14 @@ def subscriber( # type: ignore[override]
"Should be used with `stream` only."
),
] = None,
kv_watch: Annotated[
Union[str, "KvWatch", None],
Doc("KeyValue watch parameters container."),
] = None,
obj_watch: Annotated[
Union[bool, "ObjWatch"],
Doc("ObjecStore watch parameters container."),
] = False,
inbox_prefix: Annotated[
bytes,
Doc(
Expand Down Expand Up @@ -866,6 +874,8 @@ def subscriber( # type: ignore[override]
deliver_policy=deliver_policy,
headers_only=headers_only,
pull_sub=pull_sub,
kv_watch=kv_watch,
obj_watch=obj_watch,
inbox_prefix=inbox_prefix,
ack_first=ack_first,
stream=stream,
Expand Down
12 changes: 11 additions & 1 deletion faststream/nats/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
SubscriberMiddleware,
)
from faststream.nats.message import NatsBatchMessage, NatsMessage
from faststream.nats.schemas import JStream, PullSub
from faststream.nats.schemas import JStream, PullSub, KvWatch, ObjWatch
from faststream.types import SendableMessage


Expand Down Expand Up @@ -193,6 +193,14 @@ def __init__(
"Should be used with `stream` only."
),
] = None,
kv_watch: Annotated[
Union[str, "KvWatch", None],
Doc("KeyValue watch parameters container."),
] = None,
obj_watch: Annotated[
Union[bool, "ObjWatch"],
Doc("ObjecStore watch parameters container."),
] = False,
inbox_prefix: Annotated[
bytes,
Doc(
Expand Down Expand Up @@ -283,6 +291,8 @@ def __init__(
deliver_policy=deliver_policy,
headers_only=headers_only,
pull_sub=pull_sub,
kv_watch=kv_watch,
obj_watch=obj_watch,
inbox_prefix=inbox_prefix,
ack_first=ack_first,
stream=stream,
Expand Down

0 comments on commit aa5c2a7

Please sign in to comment.