Skip to content

StreamConfig

nats.js.api.StreamConfig dataclass #

Bases: Base

StreamConfig represents the configuration of a stream.

allow_direct class-attribute instance-attribute #

allow_direct: Optional[bool] = None

allow_rollup_hdrs class-attribute instance-attribute #

allow_rollup_hdrs: bool = False

deny_delete class-attribute instance-attribute #

deny_delete: bool = False

deny_purge class-attribute instance-attribute #

deny_purge: bool = False

description class-attribute instance-attribute #

description: Optional[str] = None

discard class-attribute instance-attribute #

discard: Optional[DiscardPolicy] = DiscardPolicy.OLD

duplicate_window class-attribute instance-attribute #

duplicate_window: float = 0

max_age class-attribute instance-attribute #

max_age: Optional[float] = None

max_bytes class-attribute instance-attribute #

max_bytes: Optional[int] = None

max_consumers class-attribute instance-attribute #

max_consumers: Optional[int] = None

max_msg_size class-attribute instance-attribute #

max_msg_size: Optional[int] = -1

max_msgs class-attribute instance-attribute #

max_msgs: Optional[int] = None

max_msgs_per_subject class-attribute instance-attribute #

max_msgs_per_subject: int = -1

mirror class-attribute instance-attribute #

mirror: Optional[StreamSource] = None

mirror_direct class-attribute instance-attribute #

mirror_direct: Optional[bool] = None

name class-attribute instance-attribute #

name: Optional[str] = None

no_ack class-attribute instance-attribute #

no_ack: bool = False

num_replicas class-attribute instance-attribute #

num_replicas: Optional[int] = None

placement class-attribute instance-attribute #

placement: Optional[Placement] = None

republish class-attribute instance-attribute #

republish: Optional[RePublish] = None

retention class-attribute instance-attribute #

retention: Optional[RetentionPolicy] = None

sealed class-attribute instance-attribute #

sealed: bool = False

sources class-attribute instance-attribute #

sources: Optional[List[StreamSource]] = None

storage class-attribute instance-attribute #

storage: Optional[StorageType] = None

subjects class-attribute instance-attribute #

subjects: Optional[List[str]] = None

template_owner class-attribute instance-attribute #

template_owner: Optional[str] = None

as_dict #

as_dict() -> Dict[str, object]
Source code in nats/js/api.py
def as_dict(self) -> Dict[str, object]:
    result = super().as_dict()
    result['duplicate_window'] = self._to_nanoseconds(
        self.duplicate_window
    )
    result['max_age'] = self._to_nanoseconds(self.max_age)
    return result

evolve #

evolve(**params) -> _B

Return a copy of the instance with the passed values replaced.

Source code in nats/js/api.py
def evolve(self: _B, **params) -> _B:
    """Return a copy of the instance with the passed values replaced.
    """
    return replace(self, **params)

from_response classmethod #

from_response(resp: Dict[str, Any])
Source code in nats/js/api.py
@classmethod
def from_response(cls, resp: Dict[str, Any]):
    cls._convert_nanoseconds(resp, 'max_age')
    cls._convert_nanoseconds(resp, 'duplicate_window')
    cls._convert(resp, 'placement', Placement)
    cls._convert(resp, 'mirror', StreamSource)
    cls._convert(resp, 'sources', StreamSource)
    cls._convert(resp, 'republish', RePublish)
    return super().from_response(resp)

Last update: 2023-11-13