Код: Выделить всё
// The starting method.
[FunctionName("MethodA")]
public static async Task MethodA(
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "start")] HttpRequest request,
ILogger logger)
{
// Somehow start MethodB so that it runs and we can return 202 Accepted before it finishes.
return new AcceptedResult();
}
private static async Task MethodB(ILogger logger)
{
try
{
// Insert row into table with status "running" and do logging.
// Do stuff that takes longer than 1 minute and do more logging.
}
catch(Exception exception) // Very general exception handling for pseudo-code.
{
// Update row in table to status "failed" an do some logging.
}
}
[FunctionName("MethodC")
public static async Task MethodC(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "get")] HttpRequest request,
ILogger logger)
{
// Looks for row in table, gets the status, and do logging.
// Returns 200 Ok if still running or succeeded, otherwise otherwise some failure code.
// Also returns the exact status in the table to differentiate between running and succeeded.
}
Подробнее здесь: https://stackoverflow.com/questions/615 ... it-running
Мобильная версия