caramel
Skip to content
Browse documentation
Cookbook / Background work

Give a task its own time.

Keep background work close to your data. Cold Brew uses PostgreSQL for jobs and runs them through application workers.

Draft recipeTarget: 0.4.0Not yet recipe-tested

Where the change goes

app/jobs/Typed job and its behavior
spec/Observable effects and retry cases

Keep the transaction in mind

A job enqueued inside your data transaction commits or rolls back with that transaction. Give it a small payload and define how retries should behave.

Check it synchronously

Corretto does not start background workers. Its documented test path drains due jobs synchronously, so you can assert the resulting database state.

Inside a Corretto session · after enqueueing
Caramel::ColdBrew.drain_queue!(db, "default")
The finished recipe needs a complete example

Include the job class, enqueueing action, success assertion, transaction rollback case, and retry behavior before marking this recipe verified.