from datetime import datetime
import faust
class Order(faust.Record, serializer='json', isodates=True):
id: str
user_id: str
product_id: str
amount: float
price: float
date_created: datetime = None
date_updated: datetime = None
orders_topic = app.topic('orders', value_type=Order)
@app.agent(orders_topic)
async def process_order(orders):
async for order in orders:
print(order.product_id)