Skip to content
theburningmonk edited this page Mar 15, 2013 · 1 revision
open Amazon.SimpleWorkflow
open Amazon.SimpleWorkflow.Extensions

// simple 'hello world' function which regardless of input prints "Hello World!" and returns
// an empty string
let sayHelloWorld _ = printfn "Hello World!"; ""

// workflow which has only one activity - to print hello world when received an activity task
let helloWorldWorkflow =
    Workflow(domain = "theburningmonk.com", name = "hello_world", 
             description = "simple 'hello world' example", 
             version = "1",
             identity = "Phantom") // you can optionally set the identity of your worker
    ++> Activity("say_hello_world", "say 'hello world'", sayHelloWorld,
                 taskHeartbeatTimeout       = 60, 
                 taskScheduleToStartTimeout = 10,
                 taskStartToCloseTimeout    = 10, 
                 taskScheduleToCloseTimeout = 20)

The ++> operator attaches an activity to the workflow. To start the workflow, call the Start method with an instance of AmazonSimpleWorkflowClient, the domain, workflow and activities will be registered as necessary and auto-generated decision and activity workers will be started too.

let awsKey      = "PUT_YOUR_AWS_KEY_HERE"
let awsSecret   = "PUT_YOUR_AWS_SECRET_HERE"
let client = new AmazonSimpleWorkflowClient(awsKey, awsSecret)

helloWorldWorkflow.Start(client)

Clone this wiki locally