Skip to content

0.1.2.17 (2023-06-13)

Compare
Choose a tag to compare
@Lancetnik Lancetnik released this 13 Jun 17:57
· 152 commits to main since this release

The current update is a sum of several changes and improvements released from the previous release.

The main change - Propan no longer obliges you to receive a message in the form of only one argument.
Your handler function can consume as many arguments as needed and also combine them with pydantic.BaseModel.

@router.handle(...)
async def handler(a: int, b: float):
...
async def handler(a: Message, b: float, c: str):

A few public methods for declaring objects RabbitMQ were added to RabbitBroker:

broker = RabbitBroker()
...
     await broker.declare_exchange(RabbitExchange("test"))
     await broker.declare_queue(RabbitQueue("test"))
     channel: aio_pika.RobustChannel = broker.channel

To maintain the ability to send messages and initialize channels, an after_startup hook has been added to all FastAPI PropanRouters.

router = RabbitRouter()

@router.after_startup
async def init_whatever(app: FastAPI): ...

In addition, the behavior of the __init__ and connect methods for all brokers have been improved (now the connect parameters have priority and override the __init__ parameters when connecting to the broker), a correct exception has been implemented when accessing an object unavailable for import, several errors have been fixed and other minor internal changes.

New Contributors