Skip to content

PubAck

nats.js.api.PubAck dataclass #

PubAck(
    stream: str,
    seq: int,
    domain: Optional[str] = None,
    duplicate: Optional[bool] = None,
    batch_id: Optional[str] = None,
    batch_size: Optional[int] = None,
    val: Optional[str] = None,
)

Bases: Base

PubAck is the response of publishing a message to JetStream.

stream instance-attribute #

stream: str

seq instance-attribute #

seq: int

domain class-attribute instance-attribute #

domain: Optional[str] = None

duplicate class-attribute instance-attribute #

duplicate: Optional[bool] = None

batch_id class-attribute instance-attribute #

batch_id: Optional[str] = None

batch_size class-attribute instance-attribute #

batch_size: Optional[int] = None

val class-attribute instance-attribute #

val: Optional[str] = None

from_response classmethod #

from_response(resp: Dict[str, Any]) -> PubAck
Source code in nats/js/api.py
194
195
196
197
198
199
200
201
@classmethod
def from_response(cls, resp: Dict[str, Any]) -> PubAck:
    # Server uses ``batch``/``count`` for atomic batch publish (ADR-50).
    if "batch" in resp and "batch_id" not in resp:
        resp["batch_id"] = resp.pop("batch")
    if "count" in resp and "batch_size" not in resp:
        resp["batch_size"] = resp.pop("count")
    return super().from_response(resp)

as_dict #

as_dict() -> Dict[str, object]
Source code in nats/js/api.py
203
204
205
206
207
208
209
def as_dict(self) -> Dict[str, object]:
    result = super().as_dict()
    if "batch_id" in result:
        result["batch"] = result.pop("batch_id")
    if "batch_size" in result:
        result["count"] = result.pop("batch_size")
    return result

evolve #

evolve(**params) -> _B

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

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