Skip to content

Instantly share code, notes, and snippets.

@xximjasonxx
Last active August 17, 2020 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xximjasonxx/48501320c1fbed25b11293af8e57ff3b to your computer and use it in GitHub Desktop.
Save xximjasonxx/48501320c1fbed25b11293af8e57ff3b to your computer and use it in GitHub Desktop.
[FunctionName("ApproveFile_Start")]
public static async Task HttpStart(
[BlobTrigger("files/{id}", Connection = "StorageAccountConnectionString")] Stream fileBlob,
string id,
[Table("metadata", "{id}", "{id}", Connection = "TableConnectionString")] FileMetadata metadata,
[Table("metadata", Connection = "TableConnectionString")] CloudTable metadataTable,
[DurableClient] IDurableOrchestrationClient starter,
ILogger log)
{
// Function input comes from the request content.
string instanceId = await starter.StartNewAsync("ProcessFileFlow", new ApprovalWorkflowData { TargetId = id });
metadata.WorkflowId = instanceId;
var replaceOperation = TableOperation.Replace(metadata);
var result = await metadataTable.ExecuteAsync(replaceOperation);
log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
log.LogInformation("Flow started");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment