This file contains hidden or 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
// string -> Async<Match list> | |
let findMatchingGift (wish: string) = async { | |
// Call a custom machine learning model | |
// The real implementation uses the Customer profile to adjust decisions by age, etc. | |
// but we'll keep the model simple for now. | |
} |
This file contains hidden or 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
type Reservation = | |
{ | |
Kid: Customer | |
Product: Product | |
} |
This file contains hidden or 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
type Match = | |
{ | |
Product: Product | |
Confidence: Probability | |
} |
This file contains hidden or 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
type WishList = | |
{ | |
Kid: Customer | |
Wishes: string list | |
} |
This file contains hidden or 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
using System; | |
using System.Linq; | |
using System.Net; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Microsoft.WindowsAzure.Storage; | |
using Microsoft.WindowsAzure.Storage.Queue; | |
namespace sendQueue | |
{ |
This file contains hidden or 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
var emailSendingTasks = | |
recepients | |
.Select(to => context.CallActivityAsync<bool>("SendEmail", to)) | |
.ToArray(); | |
var results = await Task.WhenAll(emailSendingTasks); | |
if (results.All(r => r)) { /* ... */ } |
This file contains hidden or 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
[FunctionName("ParallelWorkflow")] | |
public static async Task Parallel([OrchestrationTrigger] DurableOrchestrationContext context) | |
{ | |
var amsterdam = context.CallSubOrchestratorAsync("BookTrip", serverlessDaysAmsterdam); | |
var hamburg = context.CallSubOrchestratorAsync("BookTrip", serverlessDaysHamburg); | |
var expenses = await Task.WhenAll(amsterdam, hamburg); | |
await context.CallActivityAsync("ReportExpenses", expenses); | |
} |
This file contains hidden or 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
[FunctionName("CombinedOrchestrator")] | |
public static async Task CombinedOrchestrator([OrchestrationTrigger] DurableOrchestrationContext context) | |
{ | |
await context.CallSubOrchestratorAsync("BookTrip", serverlessDaysAmsterdam); | |
await context.CallSubOrchestratorAsync("BookTrip", serverlessDaysHamburg); | |
} |
This file contains hidden or 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
var options = new RetryOptions( | |
firstRetryInterval: TimeSpan.FromMinutes(1), | |
maxNumberOfAttempts: 5); | |
options.BackoffCoefficient = 2.0; | |
await context.CallActivityWithRetryAsync("BookFlight", options, itinerary); |
This file contains hidden or 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
[FunctionName("SequentialWorkflow")] | |
public static async Task Sequential([OrchestrationTrigger] DurableOrchestrationContext context) | |
{ | |
var conf = await context.CallActivityAsync<ConfTicket>("BookConference", "ServerlessDays"); | |
try | |
{ | |
var itinerary = MakeItinerary(/* ... */); | |
await context.CallActivityAsync("BookFlight", itinerary); | |
} | |
catch (FunctionFailedException) |