- Notifications
You must be signed in to change notification settings - Fork40
Node.js helpers to access the Amazon SWF API
License
ericabouaf/aws-swf
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
aws-swf provides high-level classes to build Amazon Simple Workflows using Node.js.
It is built on top of the official Node.jsaws-sdk for low-level API calls. You can find the fullAPI reference here.
- node.js >= 0.8
- An activeAWS account withAccess Keys
- Basic understanding ofAWS SimpleWorkflow concepts
npm install aws-swf
Cf.http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Setting_AWS_Credentials
The AWS SDK is sufficient to register SWF objects, since those are just direct API calls.(You can also register them through theAWS console.)
You can run the following example to register the objects used in the following examples :
Example to register "test-domain", "simple-activity" and "simple-workflow"
AnActivityPoller will wait for new tasks from SWF, and emit anactivityTask event.The event receives an instance ofActivityTask, which makes it easier to send the response to SWF.
This example starts an Activity Worker which completes immediatly.
TheDecider class will wait for new decision tasks from SWF, and emit adecisionTask event.The event receives an instance ofDecisionTask, composed of :
- anEventList instance, to query the state of the workflow
- aDecisionResponse instance, to prepare the decider response with decisions
Simple decider worker example : decision worker, which schedules an activity task, then stop the workflow.
To start a workflow, call thestart method on aWorkflow instance. This call will return aWorkflowExecution instance, which you can use to signal or terminate a workflow.
- Starting a workflow : start an instance of the simple workflow example.
Sometimes you may want to configure the AWS SDK instance. A possible reason isto set a specific region foraws-swf
. Because Node.js allows multipleinstances of the same package for maximal compatibility among libraries, youwould need to do something similar to:
varAWS=require('./node_modules/aws-swf/node_modules/aws-sdk/lib/aws');
Instead, you simlpy need to do:
varAWS=require('aws-swf').AWS;
An example use case would be:
varAWS=require('aws-swf').AWS;AWS.config=newAWS.Config({region:process.env.AWS_REGION||'us-west-2',apiVersions:{swf:'2012-01-25'}});
The API documentation is available online athttp://neyric.github.io/aws-swf/apidoc/
To rebuild the documentation, install jsdoc, then :
jsdoc lib/*.js README.md -d apidoc
Tests can be executed with Mocha :
$ mocha
To get the coverage, run :
$ ./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha
Then open coverage/lcov-report/index.html
To send the coverage to coveralls, I run locally (I don't know why travis-ci after-script doesn't work...):
$ NODE_ENV=test ./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | COVERALLS_REPO_TOKEN=xxxx ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
- aws-swf-toolkit: Node.js Framework for workflows on Amazon SWF
- aws-swf-activities: A collection of Node.js activity workers for Amazon SWF
About
Node.js helpers to access the Amazon SWF API
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors9
Uh oh!
There was an error while loading.Please reload this page.