AsyncAPIPublisher
faststream.nats.publisher.asyncapi.AsyncAPIPublisher #
AsyncAPIPublisher(*, subject, reply_to, headers, stream, timeout, broker_middlewares, middlewares, schema_, title_, description_, include_in_schema)
Bases: LogicPublisher
A class to represent a NATS publisher.
Initialize NATS publisher object.
Source code in faststream/nats/publisher/usecase.py
publish async
#
publish(message, subject='', *, headers=None, reply_to='', correlation_id=None, stream=None, timeout=None, rpc=False, rpc_timeout=30.0, raise_timeout=False, _extra_middlewares=())
Publish message directly.
PARAMETER | DESCRIPTION |
---|---|
message | Message body to send. Can be any encodable object (native python types or TYPE: |
subject | NATS subject to send message (default is TYPE: |
headers | obj: DEFAULT: |
reply_to | NATS subject name to send response (default is TYPE: |
correlation_id | Manual message correlation_id setter (default is TYPE: |
stream | This option validates that the target subject is in presented stream (default is TYPE: |
timeout | Timeout to send message to NATS in seconds (default is TYPE: |
rpc | Whether to wait for reply in blocking mode (default is TYPE: |
rpc_timeout | RPC reply waiting time (default is TYPE: |
raise_timeout | Whetever to raise TYPE: |
_extra_middlewares | obj: DEFAULT: |
Source code in faststream/nats/publisher/usecase.py
request async
#
request(message, subject='', *, headers=None, correlation_id=None, timeout=0.5, _extra_middlewares=())
Source code in faststream/nats/publisher/usecase.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
|
setup #
add_prefix #
schema #
Returns the schema of the API operation as a dictionary of channel names and channel objects.
add_middleware #
get_description #
get_payloads #
Source code in faststream/broker/publisher/usecase.py
set_test #
Turn publisher to testing mode.
Source code in faststream/broker/publisher/usecase.py
reset_test #
get_name #
get_schema #
Source code in faststream/nats/publisher/asyncapi.py
create classmethod
#
create(*, subject, reply_to, headers, stream, timeout, broker_middlewares, middlewares, schema_, title_, description_, include_in_schema)