Git Product home page Git Product logo

examples-ruby's Introduction

โš ๏ธ This repository is abandoned.

Zenaton examples for Ruby

This repository contains examples of workflows built with Zenaton. These examples illustrates how Zenaton orchestrates tasks that are executed on different workers.

Installation

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.

Running on Docker

Simply run

docker-compose build; docker-compose up

You're all set!

Running Locally

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 :)

Example 1 : Single task execution

This example showcases

  • An execution of a single task
ruby launch_single_task.rb

Example 2 : Sequential tasks execution

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.

Sequential Workflow Diagram

ruby launch_sequential.rb

Example 3: Parallel tasks execution

This example showcases

  • a parallel execution of 2 tasks
  • a third task that is executed only after both first two tasks were processed

Parallel Workflow Diagram

ruby launch_parallel.rb

Example 4: Asynchronous tasks execution

this example showcases

  • Asynchronous executions of Task A and Task B (fire and forget)
  • Then sequential executions of Task C and Task D

Asynchronous Workflow Diagram

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.

Example 5: Event

This example showcases

  • how to change a workflow's behaviour based on an external event

Event Workflow Diagram

ruby launch_event.rb

Example 6: Wait

This example showcases

  • how the provided Wait task can be used to pause the workflow for a specified duration

Wait Workflow Diagram

ruby launch_wait.rb

Example 7: Wait Event

This example showcases

  • how the provided Wait task can also be used to pause the workflow up to receiving a specific external event

WaitEvent Workflow Diagram

ruby launch_wait_event.rb

Example 8: Error Workflow

This example showcases

  • how to recover from a faulty task

Error Workflow Diagram

ruby launch_error.rb

Example 9: Recursive Workflow

This example showcases

  • how launching events or workflows directly from orchestrated tasks allows you to schedule recurring workflows
ruby launch_recursive.rb

Example 10: Workflow Versions

This example showcases

  • how to update your workflow implementation, even while previous versions are still running
ruby launch_version.rb

Example 11: Automatic retry of failed tasks

This example showcases

  • how a failed task can be retried automatically
  • how to customize the automatic retry policy
ruby launch_automatic_retry.rb

Example 12: Schedule a task

This example showcases

  • how to schedule a task to make it run periodically
ruby schedule_task_a.rb

examples-ruby's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

examples-ruby's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.