Skip to content

PullSub

faststream.nats.pull_sub.PullSub #

PullSub(
    batch_size: int = 1,
    timeout: Optional[float] = 5.0,
    batch: bool = False,
)

Bases: BaseModel

A class to represent a NATS pull subscription.

Initialize the NATS pull subscription.

PARAMETER DESCRIPTION
batch_size

The batch size.

TYPE: int DEFAULT: 1

timeout

The timeout.

TYPE: Optional[float] DEFAULT: 5.0

batch

Whether to batch.

TYPE: bool DEFAULT: False

Source code in faststream/nats/pull_sub.py
def __init__(
    self,
    batch_size: int = 1,
    timeout: Optional[float] = 5.0,
    batch: bool = False,
) -> None:
    """Initialize the NATS pull subscription.

    Args:
        batch_size: The batch size.
        timeout: The timeout.
        batch: Whether to batch.
    """
    super().__init__(
        batch_size=batch_size,
        timeout=timeout,
        batch=batch,
    )

batch class-attribute instance-attribute #

batch: bool = Field(default=False)

batch_size class-attribute instance-attribute #

batch_size: int = Field(default=1)

timeout class-attribute instance-attribute #

timeout: Optional[float] = Field(default=5.0)