You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
theburningmonk edited this page Feb 2, 2013
·
1 revision
open Amazon.SimpleWorkflow
open Amazon.SimpleWorkflow.Extensions
// function to sum an array of integers and return the sum as a double
let sum (arr : int[]) = arr |> Array.sum |> double
// the activity attached takes a function with the signature of (int[] -> double) as opposed to
// the default (string -> string), the input and output are deserialized/serialized by the
// ServiceStack.Text JSON serializer
let genericActivityWorkflow =
Workflow(domain = "theburningmonk.com", name = "generic_activity",
description = "simple generic activity example",
version = "1")
++> Activity<int[], double>("sum", "sum int array into a double", sum,
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)
genericActivityWorkflow.Start(client)