A briefly introduction to Cameron

8
cameron Workflow Engine https://github.com/leandrosilva/cameron Leandro Silva | @codezone 2011

Transcript of A briefly introduction to Cameron

Page 1: A briefly introduction to Cameron

cameronWorkflow Engine

https://github.com/leandrosilva/cameron

Leandro Silva | @codezone2011

Page 2: A briefly introduction to Cameron

What is it?

Page 3: A briefly introduction to Cameron

cameron

redis erlang_syslog

erlang/otpis built on

top of

logs thru

misultin

provides webapi thru

workflow can run many

process

has one

activity

has one or many

task is an instance of

job is an instance of

executes in parallel,pipelining output,

one or many

start urlalways has a

is endpoint to a

web serviceis the concreteimplementation

of anjson

receives andresponds

redo

stores data thru

is a driver to

configurationfiles

is defines in

can cascadeother

Page 4: A briefly introduction to Cameron

Process Tree

Page 5: A briefly introduction to Cameron

cameron

cameron_sup

cameron_process_sup cameron_web_server cameron_syslog

cameron_process_catalog cameron_job_data cameron_job_scheduler cameron_job_runner

handle_task/2

spawn_link N

cameron_redo

Actually, it spawns many instancesof gen_server cameron_job_runnerregistered as cameron_{uuid}

Being more specific...

Page 6: A briefly introduction to Cameron

Walking from request to getting things done...

Page 7: A briefly introduction to Cameron

1. POST http://cameron.i1/api/foo/start{"key":"007", "data":"blah", "requestor":"bob"}

← responds 201 and the locationurl to get job status and results

requestor cameron instance 1

{process, [{foo, {start_activity_url, "http://foo.i1/v0.0.1/start"}}]}.

Which workflow?Before make a request to a given process workflow, we need to setup it atconfig/process/{environment}.configIn this case:

foo instance 1

redis

1.1. saves the requestand schedules a

job to run

2.2. POST http://foo.i1/v0.0.1/start{"key":"007", "data":"blah", "requestor":"bob"}

← should respond 200 when sucess

cameron_job_runner

2. runs scheduled job

handle_task/2

2.1. spawns atask handler

It means, actually, spawn a new cameron_job_runner, supervised by cameron_process_sup

2.3. saves task result(being sucess or error)

has next activities?

yes

repeats thru the step 2.1., passingcurrent task result as payload

no

2.3. saves final results,job is done!

x. GET http://cameron.i1/api/foo/key/007/job/a93f89

← responds 200 and a JSON with the job results

Page 8: A briefly introduction to Cameron

Work in Progressstay tuned...