-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version 0.2.0: delays, sequential execution of a list of activities, …
…activities returning unit
- Loading branch information
1 parent
52b3f44
commit 885ee55
Showing
11 changed files
with
123 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module samples.Delay | ||
|
||
open System | ||
open Microsoft.Azure.WebJobs | ||
open DurableFunctions.FSharp | ||
|
||
let sendNewsletter = | ||
let impl (email: string) = | ||
Console.WriteLine (sprintf "Fake newsletter sent to %s" email) | ||
true | ||
Activity.define "SendNewsletter" impl | ||
|
||
let newsletter = orchestrator { | ||
|
||
let pauseDuration = TimeSpan.FromHours 1.0 | ||
|
||
let sendAndPause email = orchestrator { | ||
let! response = Activity.call sendNewsletter email | ||
do! Orchestrator.delay pauseDuration | ||
return response | ||
} | ||
|
||
let! responses = | ||
["[email protected]"; "[email protected]"; "[email protected]"] | ||
|> List.map sendAndPause | ||
|> Activity.seq | ||
|
||
return responses |> List.forall id | ||
} | ||
|
||
[<FunctionName("SendNewsletter")>] | ||
let SendNewsletter([<ActivityTrigger>] url) = Activity.run sendNewsletter url | ||
|
||
[<FunctionName("NewsletterWorkflow")>] | ||
let NewsletterWorkflow ([<OrchestrationTrigger>] context: DurableOrchestrationContext) = | ||
Orchestrator.run (newsletter, context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
namespace samples | ||
module samples.InputParameter | ||
|
||
open Microsoft.Azure.WebJobs | ||
open DurableFunctions.FSharp | ||
|
||
open TypedSequence | ||
|
||
module InputParameter = | ||
|
||
let workflow input = orchestrator { | ||
let workflow input = orchestrator { | ||
let! hello1 = Activity.call sayHello (input + " Tokyo") | ||
let! hello2 = Activity.call sayHello (input + " Seattle") | ||
let! hello3 = Activity.call sayHello (input + " London") | ||
|
||
// given "Bla" returns ["Hello Bla Tokyo!", "Hello Bla Seattle!", "Hello Bla London!"] | ||
return [hello1; hello2; hello3] | ||
} | ||
} | ||
|
||
[<FunctionName("WorkflowWithInputParameter")>] | ||
let Run ([<OrchestrationTrigger>] context: DurableOrchestrationContext) = | ||
[<FunctionName("WorkflowWithInputParameter")>] | ||
let Run ([<OrchestrationTrigger>] context: DurableOrchestrationContext) = | ||
Orchestrator.run (workflow, context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
namespace samples | ||
module samples.TypedSequence | ||
|
||
open Microsoft.Azure.WebJobs | ||
open DurableFunctions.FSharp | ||
|
||
module TypedSequence = | ||
|
||
let sayHello = | ||
let sayHello = | ||
Activity.define "SayTyped" (sprintf "Hello typed %s!") | ||
|
||
let workflow = orchestrator { | ||
let workflow = orchestrator { | ||
let! hello1 = Activity.call sayHello "Tokyo" | ||
let! hello2 = Activity.call sayHello "Seattle" | ||
let! hello3 = Activity.call sayHello "London" | ||
|
||
// returns ["Hello typed Tokyo!", "Hello typed Seattle!", "Hello typed London!"] | ||
return [hello1; hello2; hello3] | ||
} | ||
} | ||
|
||
[<FunctionName("SayTyped")>] | ||
let SayHello([<ActivityTrigger>] name) = sayHello.run name | ||
[<FunctionName("SayTyped")>] | ||
let SayHello([<ActivityTrigger>] name) = sayHello.run name | ||
|
||
[<FunctionName("TypedSequence")>] | ||
let Run ([<OrchestrationTrigger>] context: DurableOrchestrationContext) = | ||
[<FunctionName("TypedSequence")>] | ||
let Run ([<OrchestrationTrigger>] context: DurableOrchestrationContext) = | ||
Orchestrator.run (workflow, context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters