15 — Flows
A workflow is a function that can wait for weeks.
In Go
// a job queue, a worker, and retries with backoff// Tells a department's manager who joined it. flow welcome(welcome: Welcome) -> Told { let sent = effect.under(effects.tell_joined(welcome.department, employee: welcome.employee), policy: mailer) match sent { Sent -> Sent Unavailable { .. } -> Undelivered } }
policy mailer { attempts: 5 backoff: Exponential { from: 1s, to: 2m } timeout: 30s }