[英]Azure functions - durable functions, SetCustomStatus not updating
我根據“異步HTTP API”模式下的Microsoft示例創建了持久功能。
在我的代碼流中,我希望不使用“ await contextReq.CallActivityAsync”來更新“ SetCustomStatus”。
可能嗎? 因為我的持久功能保持“待處理”狀態,並且“ customStatus”沒有更新。
一些代碼片段:
[FunctionName("UpdateItemsWithProgress")]
public static async Task<HttpResponseMessage> HttpStart(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")]HttpRequestMessage req,
[OrchestrationClient]DurableOrchestrationClient starter,
ILogger log)
{
dynamic jsonMessage = await req.Content.ReadAsAsync<object>();
try
{
string contentType = req.Content.Headers?.ContentType?.MediaType;
if (contentType == "application/json")
{
string instanceId = await starter.StartNewAsync("updateTransitItem", jsonMessage);
log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
return starter.CreateCheckStatusResponse(req, instanceId);
} else
{
return starter.CreateCheckStatusResponse(req, null);
}
}
catch (Exception e)
{
return starter.CreateCheckStatusResponse(req, e.Message);
}
}
[FunctionName("updateTransitItem")]
public static async Task<object> RunOrchestrator(
[OrchestrationTrigger] DurableOrchestrationContext contextReq)
{
dynamic dynObj = contextReq.GetInput<object>();
contextReq.SetCustomStatus("Working...");
// doing stuff
contextReq.SetCustomStatus("1");
// doing stuff
contextReq.SetCustomStatus("2");
// doing stuff
return "Success"
}
可以在這里回答: https : //social.msdn.microsoft.com/Forums/en-US/767d5be5-4ba9-4b53-9838-9e32dfa7bdb3/azure-functions-durable-functions-setcustomstatusus-not-updating?forum= AzureFunctions 。
復制答案-
我不認為該狀態會在調用該活動之前一直存在。 因此,如果您從未調用過它,它將永遠不會被更新。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.