Skip to content
kendru edited this page Sep 27, 2014 · 4 revisions

Overview

Tourbillon is a distributed service for managing workflows for REST APIs. The goal is to allow you to offload recurring tasks and transactional workflows so that you can keep your code and infrastructure simple. There are three basic classes of jobs that Tourbillon will handle for you: scheduled events, recurring events, and workflows.

Job types

Scheduled events

A scheduled event is a one-time action that should occur at some point in the future. Suppose your app is an alarm clock. You can schedule an event to ping your system at the exact time that you would like your alarm to sound.

Recurring events

A recurring event is nothing more than a scheduled event that can be repeated at intervals. Do you have a birthday reminder service? You can schedule an email to be sent to your users yearly.

Workflow

A workflow is the most involved type of activity, consisting of a number of events and states. When you create a workflow, you specify how it can be executed in terms of the states in the workflow and the events that can move the workflow between states. You can also set up observers to trigger some action whenever the workflow enters a given state. This sounds somewhat complex, but an example should help clarify how this works:

Example workflow: drafting a school paper

Workflow for drafting a school paper

In the diagram above, circles represent states, solid arrows represent events, and dashed arrows represent observations.

  • We start out having no draft, and we notify the student that they need to begin writing.
  • After we receive the "Write draft" event, we are in the "Drafted" state, and we again alert the student that they have a draft ready to submit.
  • From here we can write another draft or submit the draft. Assuming we send the "Submit" event, we will be in the "Submitted" state, and the teacher will be notified that there is a draft to grade.
  • The teacher can assign a grade which will determine whether the student passes ("Grade A" or "Grade B" events), must refine a draft ("Grade C" event), must start writing a new paper from scratch ("Grade D" event), or fails ("Grade F" event). The student is notified in any of these cases.

Instead of embedding the logic for such a workflow in your system, you can simply create a Tourbillon workflow and emit events from your application. This frees you from having to keep track of transactions that are complex or span long periods of time.

Learning More