Open bitplane opened 1 year ago
you can split your code in multiple files as you do in fastapi https://fastapi.tiangolo.com/tutorial/bigger-applications/ you need to make functions for publishing and subscribing the event
I want to tightly define types of messages sent to and from topics using pydantic basemodels.
I want to tightly define types of messages sent to and from topics using pydantic basemodels.
Can you show what exactly you want?
Not sure, something like this maybe?
class MyItem(BaseModel):
value: int
@mq.subscribe("topic")
async def topic(item: MyItem):
print(f"item has a value of {item.value}")
Are there any plans to make this library more like FastAPI with regard to tightly defined models and being more opinionated about the default way to do things? If so, where would we start?
I'm thinking maybe:
on_connect
,on_message
and so on to an advanced example rather than the main oneBut I'm a noob here. Would there be any love for the models stuff? And where's best to start?