⚠️ This repository is abandoned.
This repository contains examples of workflows built with Zenaton. These examples illustrates how Zenaton orchestrates tasks that are executed on different workers.
Download this repo
git clone https://github.com/zenaton/examples-ruby.git; cd examples-ruby
then add an .env file
cp .env.example .env
and populate it with your application id and api token found here.
Simply run
docker-compose build; docker-compose up
You're all set!
Install dependencies
bundle install
Then, you need to install a Zenaton worker
curl https://install.zenaton.com | sh
and start it, and make it listen to your configuration:
zenaton start; zenaton listen --env=.env --boot=boot.rb
Your all set!
Your workflows will be processed by your worker, so you won't see anything except the stdout and stderr, respectively zenaton.out
and zenaton.err
. Look at these files :)
This example showcases
- An execution of a single task
ruby launch_single_task.rb
This example showcases
- a sequential execution of three tasks. The second and third tasks are executed only when the previous one is processed.
- In a sequential task execution, you can get the output of a task. The result of a task can be used by the next one.
ruby launch_sequential.rb
This example showcases
- a parallel execution of 2 tasks
- a third task that is executed only after both first two tasks were processed
ruby launch_parallel.rb
this example showcases
- Asynchronous executions of Task A and Task B (fire and forget)
- Then sequential executions of Task C and Task D
ruby launch_asynchronous.rb
When a task is dispatched asynchronously, the workflow continues its execution without waiting for the task completion. Consequently, a task asynchronous dispatching always returns a null value.
This example showcases
- how to change a workflow's behaviour based on an external event
ruby launch_event.rb
This example showcases
- how the provided
Wait
task can be used to pause the workflow for a specified duration
ruby launch_wait.rb
This example showcases
- how the provided
Wait
task can also be used to pause the workflow up to receiving a specific external event
ruby launch_wait_event.rb
This example showcases
- how to recover from a faulty task
ruby launch_error.rb
This example showcases
- how launching events or workflows directly from orchestrated tasks allows you to schedule recurring workflows
ruby launch_recursive.rb
This example showcases
- how to update your workflow implementation, even while previous versions are still running
ruby launch_version.rb
This example showcases
- how a failed task can be retried automatically
- how to customize the automatic retry policy
ruby launch_automatic_retry.rb
This example showcases
- how to schedule a task to make it run periodically
ruby schedule_task_a.rb