Creates long-living and AsyncAPI-documented publisher object. Args: subject: NATS subject to send message. headers: Message headers to store metainformation. **content-type** and **correlation_id** will be set automatically by framework anyway.
( # type: ignore[override]
self,
subject: str,
headers: dict[str, str] | None = None,
reply_to: str = "",
# JS
stream: Union[str, "JStream", None] = None,
timeout: float | None = None,
# AsyncAPI information
title: str | None = None,
description: str | None = None,
schema: Any | None = None,
include_in_schema: bool = True,
)
| 988 | |
| 989 | @override |
| 990 | def publisher( # type: ignore[override] |
| 991 | self, |
| 992 | subject: str, |
| 993 | headers: dict[str, str] | None = None, |
| 994 | reply_to: str = "", |
| 995 | # JS |
| 996 | stream: Union[str, "JStream", None] = None, |
| 997 | timeout: float | None = None, |
| 998 | # AsyncAPI information |
| 999 | title: str | None = None, |
| 1000 | description: str | None = None, |
| 1001 | schema: Any | None = None, |
| 1002 | include_in_schema: bool = True, |
| 1003 | ) -> "LogicPublisher": |
| 1004 | """Creates long-living and AsyncAPI-documented publisher object. |
| 1005 | |
| 1006 | Args: |
| 1007 | subject: NATS subject to send message. |
| 1008 | headers: Message headers to store metainformation. |
| 1009 | **content-type** and **correlation_id** will be set automatically by framework anyway. |
| 1010 | Can be overridden by `publish.headers` if specified. |
| 1011 | reply_to: NATS subject name to send response. |
| 1012 | stream: This option validates that the target `subject` is in presented stream. |
| 1013 | Can be omitted without any effect. |
| 1014 | timeout: Timeout to send message to NATS. |
| 1015 | title: AsyncAPI publisher object title. |
| 1016 | description: AsyncAPI publisher object description. |
| 1017 | schema: AsyncAPI publishing message type. |
| 1018 | Should be any python-native object annotation or `pydantic.BaseModel`. |
| 1019 | include_in_schema: Whetever to include operation in AsyncAPI schema or not. |
| 1020 | """ |
| 1021 | return self.broker.publisher( |
| 1022 | subject, |
| 1023 | headers=headers, |
| 1024 | reply_to=reply_to, |
| 1025 | stream=stream, |
| 1026 | timeout=timeout, |
| 1027 | title=title, |
| 1028 | description=description, |
| 1029 | schema=schema, |
| 1030 | include_in_schema=include_in_schema, |
| 1031 | ) |
no outgoing calls