Handler
faststream.nats.asyncapi.Handler #
Handler(
subject: str,
log_context_builder: Callable[
[StreamMessage[Any]], Dict[str, str]
],
queue: str = "",
stream: Optional[JStream] = None,
pull_sub: Optional[PullSub] = None,
extra_options: Optional[AnyDict] = None,
description: Optional[str] = None,
title: Optional[str] = None,
)
Bases: LogicNatsHandler
Source code in faststream/nats/handler.py
calls instance-attribute
#
calls: List[
Tuple[
HandlerCallWrapper[MsgType, Any, SendableMessage],
Callable[[StreamMessage[MsgType]], Awaitable[bool]],
AsyncParser[MsgType, Any],
AsyncDecoder[StreamMessage[MsgType]],
Sequence[Callable[[Any], BaseMiddleware]],
CallModel[Any, SendableMessage],
]
]
global_middlewares instance-attribute
#
subscription instance-attribute
#
subscription: Union[
None,
Subscription,
JetStreamContext.PushSubscription,
JetStreamContext.PullSubscription,
] = None
add_call #
add_call(
*,
handler: HandlerCallWrapper[
Msg, P_HandlerParams, T_HandlerReturn
],
dependant: CallModel[P_HandlerParams, T_HandlerReturn],
parser: Optional[CustomParser[Msg, NatsMessage]],
decoder: Optional[CustomDecoder[NatsMessage]],
filter: Filter[NatsMessage],
middlewares: Optional[
Sequence[Callable[[Msg], BaseMiddleware]]
]
) -> None
Source code in faststream/nats/handler.py
close async
#
consume async
#
Consume a message asynchronously.
PARAMETER | DESCRIPTION |
---|---|
msg | The message to be consumed. TYPE: |
RETURNS | DESCRIPTION |
---|---|
SendableMessage | The sendable message. |
RAISES | DESCRIPTION |
---|---|
StopConsume | If the consumption needs to be stopped. |
RAISES | DESCRIPTION |
---|---|
Exception | If an error occurs during consumption. |
Note
The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
Source code in faststream/broker/handler.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
|
get_payloads #
Source code in faststream/broker/handler.py
get_routing_hash staticmethod
#
name #
schema #
Source code in faststream/nats/asyncapi.py
start async
#
Source code in faststream/nats/handler.py
Last update: 2023-11-13