Every event-driven backend eventually writes this method:

async placeOrder(input: PlaceOrderInput) {

await this.db.insert(orders).values(input); // 1. write the row

await this.kafka.send({ topic: 'order.placed', … }); // 2. publish the event

}