This is the worker-only example in the set.
It demonstrates the smallest useful @kalamdb/consumer runConsumer() flow:
- a row lands in
blog.blogs - KalamDB routes the change into
blog.summarizer - the worker consumes the topic
- the worker writes
summaryback into the same row - failures are stored in
blog.summary_failures
There is no model dependency here. The summarizer is deterministic so the example is easy to read and the test is stable.
Use change.data as the blog row inside onChange(). This example routes changes from blog.blogs, which is a SHARED table in setup.sql, so change.user is expected to be undefined here.
- Make sure KalamDB is running on
http://127.0.0.1:2900. - Run
npm install. - Run
npm run setup. - Run
npm run start.
Run npm test.
The integration test starts the agent, inserts a blog row, and waits until the summary field is written back by the worker.
src/agent.ts: full worker logicsetup.sql: schema and topic routetests/summarizer.integration.test.ts: end-to-end verification