我是 Durable 功能(编排功能)的新手,并且根据 Microsoft 文档查看了示例应用程序。所以我几乎没有疑问。
例子:
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, methods: "post",
Route = "orchestrators/{functionName}")] HttpRequestMessage req,
[OrchestrationClient] DurableOrchestrationClient starter,
string functionName,
TraceWriter log)
{
// Function input comes from the request content.
dynamic eventData = await req.Content.ReadAsAsync<object>();
string instanceId = await starter.StartNewAsync(functionName, eventData);
log.Info($"Started orchestration with ID = '{instanceId}'.");
return starter.CreateCheckStatusResponse(req, instanceId);
}
为了调用它,我使用邮递员发出了 HTTP POST 请求,因此请求成功处理,但是当我配置不同的动词(如 HTTP GET)时,它在控制台中以 NotFound 错误响应,并且来自浏览器的 HTTP 请求向它发出的请求以“NotFound”错误响应在控制台中。为什么会这样?
我可以使用计时器触发天蓝色功能调用任何编排功能吗?
如果不是为什么?
更新:
有关问题的一些其他详细信息
[FunctionName("TimerTrigger")]
public static async Task Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, TraceWriter log)
{//this runs for every 5minutes
using (HttpClient client = new HttpClient())
{
var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("", "")
});
//making request to above function by http trigger
var result = await client.PostAsync("http://localhost:7071/orchestrators/E1_HelloSequence", content);
}
log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
return;
}
我可以通过计时器触发对 http 触发器的请求吗,为什么因为我的持久函数有长时间运行的过程,所以如果在计时器触发器本身中调用编排函数,那么可能有计时器触发超时的可能性,所以我为什么要尝试遵循这种方法。是可以通过上面的代码调用吗?