如何在 C# 中以编程方式检查队列触发函数的状态?
我有两个azure函数,一个是HttpTrigger
,一个是QueueTrigger
。 http 触发器的目的是从某个服务获取一些数据并将其放入 blob 存储中。队列触发器的目的是从 Blob 存储中获取数据并将其保存在本地数据库中。当http触发器完成作业时,队列触发器将自动触发。
我想知道如何知道队列函数何时以编程方式完成? 所以,我有一些服务正在调用这个 http 触发函数:
public async Task<HttpResponseMessage> CallHttpAzureFunction(int someParameter)
{
var client = new HttpClient();
var azureFunctionsPath = "someRandomPath";
var url = $"{azureFunctionsPath}/{AzureFunctionConstant.NameOfFunction}";
var request = "not important"
var response await client.PostAsync(url, new StringContent(JsonConvert.SerializeObject(request)));
if (response.Result.IsSuccessStatusCode)
{
//Check the status of queue function, if it is finished, call the database to get that data
}
}
I have two azure functions, one is HttpTrigger
, one is QueueTrigger
. The purpose of the http trigger is to get some data from some service and put it in blob storage. The purpose of queue trigger is to get that data from blob storage and save it in local database. When http trigger finish the job, the queue trigger is triggered automatically.
I am wondering how can I know when the queue function is finished programmatically?
So, I have some service which is calling this http trigger function:
public async Task<HttpResponseMessage> CallHttpAzureFunction(int someParameter)
{
var client = new HttpClient();
var azureFunctionsPath = "someRandomPath";
var url = quot;{azureFunctionsPath}/{AzureFunctionConstant.NameOfFunction}";
var request = "not important"
var response await client.PostAsync(url, new StringContent(JsonConvert.SerializeObject(request)));
if (response.Result.IsSuccessStatusCode)
{
//Check the status of queue function, if it is finished, call the database to get that data
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
目前,您无法获取 azure 函数的状态,但如果它是持久函数,您可以将客户端重定向到客户端轮询以了解操作何时完成的状态端点。
参考:
Currently, you can't get the status of the azure function but if it is a durable function you can redirect the client to a status endpoint that the client polls to learn when the operation is finished.
REFERENCES: