我有一个连续运行的 webjob 被触发来执行后台任务。当工作被触发完成工作时,我找不到跟踪或检查工作是否成功完成的方法。
有没有一种方法可以轻松检查特定消息的触发作业的状态?
var taskId =_service.GetTaskId();
CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
CloudQueue _cloudQueue = queueClient.GetQueueReference("taskqueue");
_cloudQueue.CreateIfNotExists();
var taskInfo = new TaskInformation
{
TaskId = taskId,
};
var queueMessage = new CloudQueueMessage(JsonConvert.SerializeObject(taskInfo));
await _cloudQueue.AddMessageAsync(queueMessage);
// is it possible to get the status of the queueMessage here?
// Whether the queueMessage is completed running successfully or it has failed?
功能:
public async Task Process(
[QueueTrigger("taskqueue")] TaskInformation taskInfo, string id,
int dequeueCount)
{
//this process might take a while to complete...
await _application.Run(taskInfo.TaskId);
}