Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions faststream/nats/broker/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
DEFAULT_PING_INTERVAL,
DEFAULT_RECONNECT_TIME_WAIT,
Client,
ReconnectToServerHandler,
)
from nats.aio.msg import Msg
from nats.errors import Error
Expand Down Expand Up @@ -138,13 +139,17 @@ class NatsInitKwargs(TypedDict, total=False):
Max size of the pending buffer for publishing commands.
flush_timeout:
Max duration to wait for a forced flush to occur
ws_connection_headers:
WebSockets connection headers.
reconnect_to_server_handler:
Reconnect to server handler.
"""

error_cb: "ErrorCallback" | None
disconnected_cb: "Callback" | None
error_cb: "ErrorCallback | None"
disconnected_cb: "Callback | None"
closed_cb: Callback | None
discovered_server_cb: "Callback" | None
reconnected_cb: "Callback" | None
discovered_server_cb: "Callback | None"
reconnected_cb: "Callback | None"
name: str | None
pedantic: bool
verbose: bool
Expand All @@ -160,14 +165,16 @@ class NatsInitKwargs(TypedDict, total=False):
tls_hostname: str | None
token: str | None
drain_timeout: int
signature_cb: "SignatureCallback" | None
user_jwt_cb: "JWTCallback" | None
user_credentials: "Credentials" | None
signature_cb: "SignatureCallback | None"
user_jwt_cb: "JWTCallback | None"
user_credentials: "Credentials | None"
nkeys_seed: str | None
nkeys_seed_str: str | None
inbox_prefix: str | bytes
pending_size: int
flush_timeout: float | None
ws_connection_headers: dict[str, list[str]] | None
reconnect_to_server_handler: ReconnectToServerHandler | None


class NatsBroker(
Expand Down Expand Up @@ -210,6 +217,8 @@ def __init__(
inbox_prefix: str | bytes = DEFAULT_INBOX_PREFIX,
pending_size: int = DEFAULT_PENDING_SIZE,
flush_timeout: float | None = None,
ws_connection_headers: dict[str, list[str]] | None = None,
reconnect_to_server_handler: ReconnectToServerHandler | None = None,
js_options: Union["JsInitOptions", dict[str, Any], None] = None,
graceful_timeout: float | None = None,
ack_policy: AckPolicy = EMPTY,
Expand Down Expand Up @@ -294,7 +303,11 @@ def __init__(
pending_size:
Max size of the pending buffer for publishing commands.
flush_timeout:
Max duration to wait for a forced flush to occur
Max duration to wait for a forced flush to occur.
ws_connection_headers:
WebSockets connection headers.
reconnect_to_server_handler:
Reconnect to server handler.
js_options:
JetStream initialization options.
graceful_timeout:
Expand Down Expand Up @@ -379,6 +392,7 @@ def __init__(
max_outstanding_pings=max_outstanding_pings,
dont_randomize=dont_randomize,
flusher_queue_size=flusher_queue_size,
ws_connection_headers=ws_connection_headers,
# security
tls_hostname=tls_hostname,
token=token,
Expand All @@ -394,6 +408,7 @@ def __init__(
discovered_server_cb=discovered_server_cb,
signature_cb=signature_cb,
user_jwt_cb=user_jwt_cb,
reconnect_to_server_handler=reconnect_to_server_handler,
# Basic args
routers=routers,
config=NatsBrokerConfig(
Expand Down
Loading