Skip to content

swf decider command

neyric edited this page Dec 31, 2012 · 2 revisions

swf-decider

Start a decider-poller for AWS SWF.

Usage: swf-decider

Options:
  -f, --file      file to execute in a node spawed process  [default: "/Users/neyric/git/aws-swf/cli/decider-worker.js"]
  -d, --domain    SWF domain                                [default: "aws-swf-test-domain"]
  -t, --tasklist  tasklist                                  [default: "aws-swf-tasklist"]
  -i, --identity  identity of the poller                    [default: "Decider-new-host-4.home-95630"]
  -h, --help      show this help                          
  -c, --fetchcodefile  js file which exports the fetch_code method  [default: "/Users/neyric/git/aws-swf/cli/fetch_code_file.js"]
  --accessKeyId        AWS accessKeyId                            
  --secretAccessKey    AWS secretAccessKey                        

Examples :

  # Start an decider poller for all workflow modules in the working directory
  $ cd examples/workflows
  $ swf-decider
  
  # Same thing but on a different domain & taskList
  $ cd examples/workflows
  $ swf-decider -t my-decider-taskList -d my-domain-name

How it works

What does swf-decider do :

  • Creates a Decider, which polls SWF for new decision tasks
  • For each new decision task received, spawns a node process (specified by -f), passing the decision task as an argument in JSON.
  • The default process file (decider-worker.js), will use the 'fetchcodefile' to retreive the code for the decider. (by default, it looks for a node.js module in the current working directory with the same name as the workflow) and call workflow(decisionTask)
  • When the spawed process exits, polls for new decision tasks

Advantages of spawning the decider in a new process :

  • When a decider crashes, the poller still continues to poll for new decision tasks
  • In development mode, you don't need to restart the poller to change the decider

Writing deciders

Check the Writing deciders page