# Background work

Source: https://docs.anetos.dev/guides/background-work/

- [Queues](https://docs.anetos.dev/guides/queues/index.md): Run slow or failure-prone work in the background: charge a card, send an email, build a report. A request dispatches a **job**, a typed struct, and responds at once. **Workers** run the job later, retry it when it fails, and keep a record of the jobs that failed for good. The complete app is [`examples/queue`](https://github.com/anetos-dev/anetos/tree/v0.5.0/examples/queue).
- [Events](https://docs.anetos.dev/guides/events/index.md): Emit an event when something happens, and let listeners react: write an audit log, email a receipt, update a dashboard. The code that places an order then doesn't need to know about all of them. Events are typed Go values, and listeners are functions of their type. The complete app is [`examples/queue`](https://github.com/anetos-dev/anetos/tree/v0.5.0/examples/queue).
- [Scheduling](https://docs.anetos.dev/guides/scheduling/index.md): Run tasks on a schedule: prune old rows every night, send a report every hour, sync with another service every five minutes. The scheduler runs in your app's binary, as a supervised component, so there is no crontab to install and nothing to run every minute. The complete app is [`examples/queue`](https://github.com/anetos-dev/anetos/tree/v0.5.0/examples/queue).
- [Run background tasks](https://docs.anetos.dev/guides/background-tasks/index.md): Run long-lived work, such as a poller, a cache warmer or a heartbeat, as a supervised goroutine that restarts on failure and stops cleanly on deploy.
- [Pub/sub listeners](https://docs.anetos.dev/guides/pubsub/index.md): Listen to message streams other services publish, such as `orders.created`, and publish your own, from the same binary as your web app. Where the [queue](https://docs.anetos.dev/guides/queues/index.md) runs an app's own jobs, pub/sub connects services: each subscription gets every message of a topic. The complete app is [`examples/pubsub`](https://github.com/anetos-dev/anetos/tree/v0.5.0/examples/pubsub), a billing service.
