|
1 | | -class SQSBroker: |
2 | | - # TODO |
3 | | - pass |
| 1 | +from types import TracebackType |
| 2 | +from typing import Any, Awaitable, Callable, Dict, Optional, Sequence, Type, Union |
| 3 | + |
| 4 | +from aiobotocore.client import AioBaseClient |
| 5 | +from fast_depends.dependencies import Depends |
| 6 | + |
| 7 | +from faststream import BaseMiddleware |
| 8 | +from faststream.broker.core.asyncronous import BrokerAsyncUsecase, default_filter |
| 9 | +from faststream.broker.message import StreamMessage |
| 10 | +from faststream.broker.publisher import BasePublisher |
| 11 | +from faststream.broker.push_back_watcher import BaseWatcher |
| 12 | +from faststream.broker.types import ( |
| 13 | + CustomDecoder, |
| 14 | + CustomParser, |
| 15 | + Filter, |
| 16 | + MsgType, |
| 17 | + P_HandlerParams, |
| 18 | + T_HandlerReturn, |
| 19 | + WrappedReturn, |
| 20 | +) |
| 21 | +from faststream.broker.wrapper import HandlerCallWrapper |
| 22 | +from faststream.sqs.asyncapi import Handler, Publisher |
| 23 | +from faststream.sqs.producer import SQSFastProducer |
| 24 | +from faststream.sqs.shared.logging import SQSLoggingMixin |
| 25 | +from faststream.types import AnyDict, SendableMessage |
| 26 | + |
| 27 | + |
| 28 | +class SQSBroker( |
| 29 | + SQSLoggingMixin, |
| 30 | + BrokerAsyncUsecase[AnyDict, AioBaseClient], |
| 31 | +): |
| 32 | + handlers: Dict[str, Handler] # type: ignore[assignment] |
| 33 | + _publishers: Dict[str, Publisher] # type: ignore[assignment] |
| 34 | + _producer: Optional[SQSFastProducer] |
| 35 | + |
| 36 | + async def start(self) -> None: |
| 37 | + pass |
| 38 | + |
| 39 | + async def _connect(self, **kwargs: Any) -> AioBaseClient: |
| 40 | + pass |
| 41 | + |
| 42 | + async def _close( |
| 43 | + self, |
| 44 | + exc_type: Optional[Type[BaseException]] = None, |
| 45 | + exc_val: Optional[BaseException] = None, |
| 46 | + exec_tb: Optional[TracebackType] = None, |
| 47 | + ) -> None: |
| 48 | + pass |
| 49 | + |
| 50 | + def _process_message( |
| 51 | + self, |
| 52 | + func: Callable[[StreamMessage[MsgType]], Awaitable[T_HandlerReturn]], |
| 53 | + watcher: BaseWatcher, |
| 54 | + ) -> Callable[[StreamMessage[MsgType]], Awaitable[WrappedReturn[T_HandlerReturn]],]: |
| 55 | + pass |
| 56 | + |
| 57 | + async def publish( |
| 58 | + self, |
| 59 | + message: SendableMessage, |
| 60 | + *args: Any, |
| 61 | + reply_to: str = "", |
| 62 | + rpc: bool = False, |
| 63 | + rpc_timeout: Optional[float] = None, |
| 64 | + raise_timeout: bool = False, |
| 65 | + **kwargs: Any, |
| 66 | + ) -> Optional[SendableMessage]: |
| 67 | + pass |
| 68 | + |
| 69 | + def subscriber( |
| 70 | + self, |
| 71 | + *broker_args: Any, |
| 72 | + retry: Union[bool, int] = False, |
| 73 | + dependencies: Sequence[Depends] = (), |
| 74 | + decoder: Optional[CustomDecoder[StreamMessage[MsgType]]] = None, |
| 75 | + parser: Optional[CustomParser[MsgType, StreamMessage[MsgType]]] = None, |
| 76 | + middlewares: Optional[Sequence[Callable[[MsgType], BaseMiddleware]]] = None, |
| 77 | + filter: Filter[StreamMessage[MsgType]] = default_filter, |
| 78 | + _raw: bool = False, |
| 79 | + _get_dependant: Optional[Any] = None, |
| 80 | + **broker_kwargs: Any, |
| 81 | + ) -> Callable[ |
| 82 | + [ |
| 83 | + Union[ |
| 84 | + Callable[P_HandlerParams, T_HandlerReturn], |
| 85 | + HandlerCallWrapper[MsgType, P_HandlerParams, T_HandlerReturn], |
| 86 | + ] |
| 87 | + ], |
| 88 | + HandlerCallWrapper[MsgType, P_HandlerParams, T_HandlerReturn], |
| 89 | + ]: |
| 90 | + pass |
| 91 | + |
| 92 | + def publisher( |
| 93 | + self, key: Any, publisher: BasePublisher[MsgType] |
| 94 | + ) -> BasePublisher[MsgType]: |
| 95 | + pass |
0 commit comments