Skip to content

JStream

faststream.nats.JStream #

JStream(
    name: str,
    *args: Any,
    declare: bool = True,
    **kwargs: Any
)

Bases: NameRequired

Source code in faststream/nats/js_stream.py
def __init__(
    self,
    name: str,
    *args: Any,
    declare: bool = True,
    **kwargs: Any,
) -> None:
    super().__init__(
        name=name,
        declare=declare,
        subjects=[],
        config=StreamConfig(
            *args,
            name=name,
            **kwargs,  # type: ignore[misc]
        ),
    )

config instance-attribute #

config: StreamConfig

declare class-attribute instance-attribute #

declare: bool = Field(default=True)

name class-attribute instance-attribute #

name: str = Field(...)

subjects class-attribute instance-attribute #

subjects: List[str] = Field(default_factory=list)

validate classmethod #

validate(
    value: Union[str, NameRequiredCls, None]
) -> Optional[NameRequiredCls]

Validates a value.

PARAMETER DESCRIPTION
value

The value to be validated.

TYPE: Union[str, NameRequiredCls, None]

RETURNS DESCRIPTION
Optional[NameRequiredCls]

The validated value.

Note

The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)

Source code in faststream/broker/schemas.py
@classmethod
def validate(
    cls: Type[NameRequiredCls], value: Union[str, NameRequiredCls, None]
) -> Optional[NameRequiredCls]:
    """Validates a value.

    Args:
        value: The value to be validated.

    Returns:
        The validated value.
    !!! note

        The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
    """
    if value is not None:
        if isinstance(value, str):
            value = cls(value)
    return value

Last update: 2023-11-13