public async Task <HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = "start/{orchestratorName}/{id?}")] HttpRequestMessage req,
            [DurableClient] IDurableClient orchestratorClient,
            string orchestratorName,
            string id,
            ILogger log)
        {
            var orchestratorInput = await req.Content.ReadAsAsync <object>();

            string instanceId = id;

            if (string.IsNullOrEmpty(instanceId))
            {
                // Start a new Orchestrator and let Durable Functions generate the instance id.
                instanceId = await orchestratorClient.StartNewAsync(
                    orchestratorName,
                    orchestratorInput);
            }
            else
            {
                // Start a new Orchestrator and use your own instance id.
                instanceId = await orchestratorClient.StartNewAsync(
                    orchestratorName,
                    instanceId,
                    orchestratorInput);
            }

            log.LogInformation($"Started Orchestrator with ID = '{instanceId}'...");

            return(orchestratorClient.CreateCheckStatusResponse(req, instanceId));
        }
Пример #2
0
        public static async Task <IActionResult> StartSearch(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
            [DurableClient] IDurableClient client,
            ILogger log)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");

            string query = req.Query["q"];

            string  requestBody = await new StreamReader(req.Body).ReadToEndAsync();
            dynamic data        = JsonConvert.DeserializeObject(requestBody);

            query = query ?? data?.q;

            if (string.IsNullOrWhiteSpace(query))
            {
                return(new BadRequestObjectResult("Query (q) is required."));
            }

            var id = await client.StartNewAsync(nameof(SearchWorkflow), (object)query);

            // set a workflow that watches the workflow
            var queryCheckBase = $"{req.Scheme}://{req.Host.Value}{req.Path.Value}".Replace($"api/{nameof(StartSearch)}", string.Empty);
            var checkUrl       = $"{queryCheckBase}runtime/webhooks/durabletask/instances/{id}";
            await client.StartNewAsync(nameof(WatchWorkflow), (object)checkUrl);

            return(new OkObjectResult(id));
        }
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "genericHttp")] HttpRequest req,
            [DurableClient] IDurableClient client,
            ILogger log)
        {
            string        requestBody = await new StreamReader(req.Body).ReadToEndAsync();
            Arguments     arguments   = JsonConvert.DeserializeObject <Arguments>(requestBody);
            IActionResult response;

            try
            {
                DateTime starttime = DateTime.UtcNow;

                if (arguments.InstanceId == null)
                {
                    // start the orchestration, and wait for the persistence confirmation
                    arguments.InstanceId = await client.StartNewAsync <JToken>(arguments.Name, null, arguments.Input);

                    // then wait for completion
                    response = await client.WaitForCompletionOrCreateCheckStatusResponseAsync(req, arguments.InstanceId, TimeSpan.FromSeconds(arguments.Timeout));
                }
                else
                {
                    // issue start and wait together. This can be a bit faster for orchestrations that complete very quickly.
                    Task start = client.StartNewAsync <JToken>(arguments.Name, arguments.InstanceId, arguments.Input);
                    Task <IActionResult> completion = client.WaitForCompletionOrCreateCheckStatusResponseAsync(req, arguments.InstanceId, TimeSpan.FromSeconds(arguments.Timeout));
                    await start;
                    response = await completion;
                }

                DateTime endtime = DateTime.UtcNow;

                if (response is ObjectResult objectResult &&
                    objectResult.Value is HttpResponseMessage responseMessage &&
                    responseMessage.StatusCode == System.Net.HttpStatusCode.OK &&
                    responseMessage.Content is StringContent stringContent)
                {
                    if (arguments.UseReportedLatency)
                    {
                        var state = await client.GetStatusAsync(arguments.InstanceId, false, false, false);

                        starttime = state.CreatedTime;
                        endtime   = state.LastUpdatedTime;
                    }
                    response = new OkObjectResult(new Response {
                        Result   = await stringContent.ReadAsStringAsync(),
                        Time     = endtime,
                        Duration = (endtime - starttime).TotalMilliseconds
                    });
                }
                else
                {
                    return(response); // it is a 202 response that will be interpreted as a timeout
                }
            }
Пример #4
0
        public static async Task <IActionResult> NewUser(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)]
            HttpRequest req,
            [Queue(Global.QUEUE)] IAsyncCollector <string> console,
            [DurableClient] IDurableClient starter,
            ILogger log)
        {
            log.LogInformation("NewUser called.");

            string  requestBody = await new StreamReader(req.Body).ReadToEndAsync();
            dynamic data        = JsonConvert.DeserializeObject(requestBody);
            string  name        = data?.name;

            if (string.IsNullOrWhiteSpace(name))
            {
                await console.AddAsync("An attempt to create a user with no name was made.");

                return(new BadRequestObjectResult("User name is required."));
            }

            var userCheck = await starter.ReadUserEntityAsync <User>(name);

            if (userCheck.EntityExists)
            {
                await console.AddAsync($"Attempt to add duplicate user {name} failed.");

                return(new BadRequestObjectResult("Duplicate username is not allowed."));
            }

            // create the user here
            var id = name.AsEntityIdFor <User>();
            await starter.SignalEntityAsync <IUserOperations>(
                id, user => user.New(name));

            await starter.SignalEntityAsync(
                UserCounter.Id,
                UserCounter.NewUser);

            await starter.StartNewAsync(nameof(NewUserParallelFunctions.RunUserParallelWorkflow), name);

            log.LogInformation("Started new parallel workflow for user {user}", name);

            await starter.StartNewAsync(nameof(MonitorFunctions.UserMonitorWorkflow), name);

            log.LogInformation("Started new monitor workflow for user {user}", name);

            return(new OkResult());
        }
 public async Task TriggerUserProvisioningApprovalWorkflow(
     [RabbitMQTrigger("approvalqueue", ConnectionStringSetting = "rabbitMQ")] ProvisionNewUserSingleGroup command,
     [DurableClient] IDurableClient starter,
     ILogger logger)
 {
     await starter.StartNewAsync(Constants.FunctionNames.Orchestrator.ExecuteUserProvisioninApprovalgWorkflow, command.CorrelationId.ToString(), command);
 }
 public async Task TriggerUserProvisioningFanInFanOutWorkflow(
     [RabbitMQTrigger("faninfanoutqueue", ConnectionStringSetting = "rabbitMQ")] ProvisionNewUserMultipleGroups command,
     [DurableClient] IDurableClient starter,
     ILogger logger)
 {
     await starter.StartNewAsync(Constants.FunctionNames.Orchestrator.StartProvisionUserWithMultipleGroupsOrchestrator, command.CorrelationId.ToString(), command);
 }
Пример #7
0
        public async Task <HttpResponseMessage> SendEmailWithTemplateHttp([HttpTrigger(AuthorizationLevel.Function, "POST")] HttpRequestMessage request, [DurableClient] IDurableClient client)
        {
            Dictionary <string, string> data = null;
            var json = await request.Content.ReadAsStringAsync();

            if (!string.IsNullOrEmpty(json))
            {
                data = JsonConvert.DeserializeObject <Dictionary <string, string> >(json);
            }

            var query = request.RequestUri.ParseQueryString();

            var sendRequest = new SendEmailWithTemplateRequest
            {
                From         = query.Get("from"),
                FromName     = query.Get("fromname"),
                TemplateData = data,
                TemplateId   = query.Get("templateid"),
                To           = query.Get("to"),
                ToName       = query.Get("toname")
            };

            var instanceId = await client.StartNewAsync(Names.SendEmailWithTemplateOrch, sendRequest);

            return(client.CreateCheckStatusResponse(request, instanceId));
        }
Пример #8
0
        public static async Task <HttpResponseMessage> Start(
            [HttpTrigger(AuthorizationLevel.Function, methods: "post", Route = "StartManyInstances")] HttpRequestMessage req,
            [DurableClient] IDurableClient starter,
            ILogger log)
        {
            int num = await HttpContentExtensions.ReadAsAsync <int>(req.Content);

            if (num <= 0)
            {
                return(req.CreateErrorResponse(HttpStatusCode.BadRequest, "Request body expects an instance count."));
            }

            log.LogWarning($"Starting {num} instances...");
            var parallelOptions = new ParallelOptions
            {
                MaxDegreeOfParallelism = 100
            };

            Parallel.For(0, num, parallelOptions, delegate(int i)
            {
                string text = $"instance_{i:000000}";
                starter.StartNewAsync <object>("HelloSequence", text, null).GetAwaiter().GetResult();
            });

            log.LogWarning($"Created {num} instances successfully!");
            return(req.CreateResponse());
        }
        /// <inheritdoc/>
        public async Task <Guid> StartReindexingInstancesAsync(IReadOnlyCollection <int> tagKeys, CancellationToken cancellationToken = default)
        {
            EnsureArg.IsNotNull(tagKeys, nameof(tagKeys));
            EnsureArg.HasItems(tagKeys, nameof(tagKeys));

            // Start the re-indexing orchestration
            Guid instanceGuid = _guidFactory.Create();

            // TODO: Pass token when supported
            string instanceId = await _durableClient.StartNewAsync(
                FunctionNames.ReindexInstances,
                OperationId.ToString(instanceGuid),
                new ReindexInput { QueryTagKeys = tagKeys });

            _logger.LogInformation("Successfully started new orchestration instance with ID '{InstanceId}'.", instanceId);

            // Associate the tags to the operation and confirm their processing
            IReadOnlyList <ExtendedQueryTagStoreEntry> confirmedTags = await _extendedQueryTagStore.AssignReindexingOperationAsync(
                tagKeys,
                instanceGuid,
                returnIfCompleted : true,
                cancellationToken : cancellationToken);

            return(confirmedTags.Count > 0 ? instanceGuid : throw new ExtendedQueryTagsAlreadyExistsException());
        }
        public async Task AddFailure(FailureRequest req)
        {
            if (State == CircuitState.Open)
            {
                _log.LogInformation($"Tried to add additional failure to {Entity.Current.EntityKey} that is already open.");
                return;
            }

            FailureWindow.Add(req.RequestId, req);

            var cutoff = req.FailureTime.Subtract(windowSize);

            // Filter the window only to exceptions within the cutoff timespan
            FailureWindow = FailureWindow.Where(p => p.Value.FailureTime >= cutoff).ToDictionary(p => p.Key, p => p.Value);

            if (FailureWindow.Count >= failureThreshold)
            {
                _log.LogCritical($"Break this circuit for entity {Entity.Current.EntityKey}!");

                await _durableClient.StartNewAsync(nameof(OpenCircuitOrchestrator.OpenCircuit), req.InstanceId);

                // Mark the circuit as "open" (circuit is broken)
                State = CircuitState.Open;
            }
            else
            {
                _log.LogInformation($"The circuit {Entity.Current.EntityKey} currently has {FailureWindow.Count} exceptions in the window of {windowSize.ToString()}");
            }
        }
Пример #11
0
        public async Task Timer([TimerTrigger("0 0 0 * * 1,5")] TimerInfo timer, [DurableClient] IDurableClient starter, ILogger log)
        {
            // Function input comes from the request content.
            var instanceId = await starter.StartNewAsync(nameof(RenewCertificates) + "_" + nameof(Orchestrator));

            log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
        }
Пример #12
0
        public async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req,
            [DurableClient] IDurableClient client,
            ILogger log)
        {
            var circuitBreakerId = "abc123";

            if (!await this.circuitBreakerClient.IsExecutionPermitted(circuitBreakerId, log, client))
            {
                log?.LogError($"{FunctionName}: Service unavailable.");
                return(new StatusCodeResult((int)HttpStatusCode.ServiceUnavailable));
            }

            var orchestratorInput = new Orchestrator.Input()
            {
                CircuitBreakerId = circuitBreakerId,
            };

            var instanceId = await client.StartNewAsync(Orchestrator.FunctionName, orchestratorInput);

            var instanceManagementPayload = client.CreateHttpManagementPayload(instanceId);

            return(new ObjectResult(instanceManagementPayload)
            {
                StatusCode = 202
            });
        }
Пример #13
0
        private static async Task <ICommandResult> StartCommandOrchestration(IDurableClient durableClient, IOrchestratorCommand orchestratorCommand)
        {
            var orchestratorCommandMessage = new OrchestratorCommandMessage(orchestratorCommand);
            var orchestratorCommandResult  = orchestratorCommand.CreateResult();

            var orchestratorCommandOrchestration = orchestratorCommand switch
            {
                _ => $"{orchestratorCommand.GetType().Name}Orchestration"
            };

            try
            {
                var instanceId = await durableClient
                                 .StartNewAsync <object>(orchestratorCommandOrchestration, orchestratorCommand.CommandId.ToString(), orchestratorCommandMessage)
                                 .ConfigureAwait(false);

                var status = await durableClient
                             .GetStatusAsync(instanceId)
                             .ConfigureAwait(false);

                orchestratorCommandResult.ApplyStatus(status);
            }
            catch (FunctionFailedException exc)
            {
                orchestratorCommandResult.Errors.Add(exc);
            }

            return(orchestratorCommandResult);
        }
    }
Пример #14
0
        public async Task <IActionResult> HttpStart(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "certificate")] CertificatePolicyItem certificatePolicyItem,
            [DurableClient] IDurableClient starter,
            ILogger log)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(Unauthorized());
            }

            if (!TryValidateModel(certificatePolicyItem))
            {
                return(ValidationProblem(ModelState));
            }

            if (string.IsNullOrEmpty(certificatePolicyItem.CertificateName))
            {
                certificatePolicyItem.CertificateName = certificatePolicyItem.DnsNames[0].Replace("*", "wildcard").Replace(".", "-");
            }

            // Function input comes from the request content.
            var instanceId = await starter.StartNewAsync(nameof(SharedOrchestrator.IssueCertificate), certificatePolicyItem);

            log.LogInformation($"Started orchestration with ID = '{instanceId}'.");

            return(AcceptedAtFunction(nameof(GetInstanceState) + "_" + nameof(GetInstanceState.HttpStart), new { instanceId }, null));
        }
        public static async Task <bool> ProjectCommandSerializationActivity(
            [ActivityTrigger] ProjectCommandNotification notification,
            [DurableClient] IDurableClient durableClient)
        {
            if (notification is null)
            {
                throw new ArgumentNullException(nameof(notification));
            }

            if (durableClient is null)
            {
                throw new ArgumentNullException(nameof(durableClient));
            }

            var status = await durableClient
                         .GetStatusAsync(notification.CorrelationId.ToString())
                         .ConfigureAwait(false);

            if (!status.IsFinalRuntimeStatus())
            {
                _ = await durableClient
                    .StartNewAsync(nameof(ProjectCommandMonitoring.ProjectCommandMonitoringOrchestrator), notification)
                    .ConfigureAwait(false);

                return(true); // command monitoring started
            }

            return(false); // no command monitoring started
        }
        public async Task <IActionResult> AddCertificate_HttpStart(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "add-certificate")] HttpRequest req,
            [DurableClient] IDurableClient starter,
            ILogger log)
        {
            if (!req.HttpContext.User.Identity.IsAuthenticated)
            {
                return(new UnauthorizedResult());
            }

            var request = JsonConvert.DeserializeObject <AddCertificateRequest>(await req.ReadAsStringAsync());

            if (string.IsNullOrEmpty(request.ResourceGroupName))
            {
                return(new BadRequestObjectResult($"{nameof(request.ResourceGroupName)} is empty."));
            }

            if (string.IsNullOrEmpty(request.SiteName))
            {
                return(new BadRequestObjectResult($"{nameof(request.SiteName)} is empty."));
            }

            if (request.Domains == null || request.Domains.Length == 0)
            {
                return(new BadRequestObjectResult($"{nameof(request.Domains)} is empty."));
            }

            // Function input comes from the request content.
            var instanceId = await starter.StartNewAsync(nameof(AddCertificate), request);

            log.LogInformation($"Started orchestration with ID = '{instanceId}'.");

            return(starter.CreateCheckStatusResponse(req, instanceId, true));
        }
Пример #17
0
        public static async Task QueueStart(
            [QueueTrigger(SaleFinderQueueNames.SaleFinderCataloguesToScan)] SaleFinderCatalogueDownloadInformation downloadInformation,
            [DurableClient] IDurableClient starter,
            ILogger log
            )
        {
            #region null checks
            if (downloadInformation is null)
            {
                throw new ArgumentNullException(nameof(downloadInformation));
            }

            if (starter is null)
            {
                throw new ArgumentNullException(nameof(starter));
            }

            if (log is null)
            {
                throw new ArgumentNullException(nameof(log));
            }
            #endregion

            string instanceId = await starter.StartNewAsync(SaleFinderFunctionNames.ScanSaleFinderCatalogue, downloadInformation).ConfigureAwait(false);

            log.LogInformation($"Started {SaleFinderFunctionNames.ScanSaleFinderCatalogue} orchestration with ID = '{instanceId}'.");
        }
        public static async Task <IActionResult> RunLambda(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "maskopy")] HttpRequest req,
            [DurableClient] IDurableClient client,
            ILogger log)
        {
            var testname = Util.MakeTestName(req);

            //bool waitForCompletion = true;

            try
            {
                log.LogWarning($"Starting {testname} ...");

                string requestBody = await new StreamReader(req.Body).ReadToEndAsync();

                dynamic inputJson = JToken.Parse(requestBody);

                int numberSequential = inputJson.sequential;

                var stopwatch = new System.Diagnostics.Stopwatch();
                stopwatch.Start();

                var sequentialOrchestrationInstanceId = $"MaskopyMaster:sequential-{testname}";
                var sequentialInput = new Tuple <string, bool>(requestBody, false);
                await client.StartNewAsync(nameof(MaskopyOrchestrations), sequentialOrchestrationInstanceId, sequentialInput);

                log.LogInformation($"{testname} started {sequentialOrchestrationInstanceId} with input {sequentialInput.Item1}");
                var sequentialResponse = await client.WaitForCompletionOrCreateCheckStatusResponseAsync(req, sequentialOrchestrationInstanceId, TimeSpan.FromMinutes(20));

                //var parallelOrchestrationInstanceId = $"ImageRecognitionMaster:parallel-{testname}";
                //var parallelInput = new Tuple<string, bool>(requestBody, true);
                //await client.StartNewAsync(nameof(ImageRecognitionOrchestrations), parallelOrchestrationInstanceId, parallelInput);
                //log.LogInformation($"{testname} started {parallelOrchestrationInstanceId} with input {parallelInput.Item1}");
                //var parallelResponse = await client.WaitForCompletionOrCreateCheckStatusResponseAsync(req, parallelOrchestrationInstanceId, TimeSpan.FromMinutes(10));

                stopwatch.Stop();

                log.LogWarning($"Completed {testname}.");

                object resultObject = new
                {
                    testname,
                    elapsedSeconds = stopwatch.Elapsed.TotalSeconds
                };

                string resultString = $"{JsonConvert.SerializeObject(resultObject, Formatting.None)}\n";

                return(new OkObjectResult(resultString));
            }
            catch (Exception e)
            {
                return(new ObjectResult(
                           new
                {
                    testname,
                    error = e.ToString(),
                }));
            }
        }
Пример #19
0
        public async Task Run([ServiceBusTrigger("%TopicName%", "%SubscriptionName%", Connection = "SERVICEBUS_CONNECTION")] MyMessage message,
                              [DurableClient] IDurableClient orchestrationClient,
                              ILogger log)
        {
            var instanceId = await orchestrationClient.StartNewAsync("EventProcessingOrchestrator", message);

            log.LogInformation($"C# ServiceBus topic trigger function processed message: {message}");
        }
Пример #20
0
        public async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "monitoring-manager")] HttpRequest req,
            [DurableClient] IDurableClient durableClient)
        {
            var instance = await durableClient.StartNewAsync(nameof(MonitoringOrchestrator));

            return(durableClient.CreateCheckStatusResponse(req, instance));
        }
Пример #21
0
        public static async Task <HttpResponseMessage> Client_StartDurableHttp(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequestMessage request,
            [DurableClient] IDurableClient starter)
        {
            string instanceId = await starter.StartNewAsync(nameof(Orchestrator_CallDurableHttp));

            return(starter.CreateCheckStatusResponse(request, instanceId));
        }
        public static async Task <IActionResult> Http(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequest req,
            [DurableClient] IDurableClient client)
        {
            string id = await client.StartNewAsync("Orchestration", null);

            return(client.CreateCheckStatusResponse(req, id));
        }
        public static async Task <IActionResult> HttpStart(
            [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req,
            [DurableClient] IDurableClient client,
            ILogger log)
        {
            var instanceId = await client.StartNewAsync(nameof(DemoOrchestrator), null);

            return(new OkObjectResult(""));
        }
        public async Task <ActionResult <TodoItem> > PostTodoItem(TodoItem todoItem)
        {
            _context.TodoItems.Add(todoItem);
            await _context.SaveChangesAsync();

            string instanceId = await _client.StartNewAsync <string>("SetReminder", todoItem.Name);

            return(CreatedAtAction("GetTodoItem", new { id = todoItem.Id }, todoItem));
        }
Пример #25
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
            [DurableClient] IDurableClient starter,
            ILogger log)
        {
            string instanceId = await starter.StartNewAsync("process-proposal-orchestration");

            return(starter.CreateCheckStatusResponse(req, instanceId));
        }
Пример #26
0
        public async Task <HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = "multiple")]
            HttpRequestMessage req,
            [DurableClient] IDurableClient orchestrationClient,
            ILogger log)
        {
            var orchestratorInput = await req.Content.ReadAsAsync <object>();

            var instanceIdA = await orchestrationClient.StartNewAsync(
                nameof(DemoOrchestratorA),
                orchestratorInput);

            var instanceIdB = await orchestrationClient.StartNewAsync(
                nameof(DemoOrchestratorB),
                orchestratorInput);

            return(orchestrationClient.CreateCheckStatusResponse(req, instanceIdB));
        }
Пример #27
0
        public static async Task <IActionResult> NewUser(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)]
            HttpRequest req,
            [Queue(Global.QUEUE)] IAsyncCollector <string> console,
            [Table(nameof(User))] CloudTable table,
            [DurableClient] IDurableClient starter,
            ILogger log)
        {
            log.LogInformation("NewUser called.");

            string  requestBody = await new StreamReader(req.Body).ReadToEndAsync();
            dynamic data        = JsonConvert.DeserializeObject(requestBody);
            string  name        = data?.name;

            if (string.IsNullOrWhiteSpace(name))
            {
                await console.AddAsync("An attempt to create a user with no name was made.");

                return(new BadRequestObjectResult("User name is required."));
            }

            var client   = table.AsClientFor <User>();
            var tempUser = new User {
                Name = name
            };
            var userCheck = await client.GetAsync(tempUser.PartitionKey, name);

            if (userCheck != null)
            {
                await console.AddAsync($"Attempt to add duplicate user {name} failed.");

                return(new BadRequestObjectResult("Duplicate username is not allowed."));
            }

            await starter.StartNewAsync(nameof(NewUserParallelFunctions.RunUserParallelWorkflow), name);

            log.LogInformation("Started new parallel workflow for user {user}", name);

            await starter.StartNewAsync(nameof(MonitorFunctions.UserMonitorWorkflow), name);

            log.LogInformation("Started new monitor workflow for user {user}", name);

            return(new OkResult());
        }
Пример #28
0
        public async Task Run(
            [ServiceBusTrigger("neo-events", "%SubscriptionName%", Connection = "NEOEventsTopic")] DetectedNeoEvent detectedNeoEvent,
            [DurableClient] IDurableClient durableClient,
            ILogger log)
        {
            var instanceId = await durableClient.StartNewAsync(nameof(NeoEventProcessingOrchestrator),
                                                               detectedNeoEvent);

            log.LogInformation($"Servicebus started orchestration with ID {instanceId}.");
        }
        public async Task <HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Function, nameof(HttpMethod.Get))] HttpRequestMessage requestMessage,
            [DurableClient] IDurableClient client,
            ILogger logger)
        {
            var instanceId = await client.StartNewAsync(
                nameof(OrchestratorWithDF1xxWarnings));

            return(client.CreateCheckStatusResponse(requestMessage, instanceId));
        }
        public async Task PurgeCertificates_Timer(
            [TimerTrigger("0 0 6 * * 0")] TimerInfo timer,
            [DurableClient] IDurableClient starter,
            ILogger log)
        {
            // Function input comes from the request content.
            var instanceId = await starter.StartNewAsync(nameof(PurgeCertificates), null);

            log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
        }