flyt

15 — Flows

A workflow is a function that can wait for weeks.

In Go// a job queue, a worker, and retries with backoff
staffing/flows.flyt
// 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
  }
}
staffing/policies.flyt
policy mailer {
  attempts: 5
  backoff: Exponential { from: 1s, to: 2m }
  timeout: 30s
}