队列触发的Azure函数成功完成,但最终引发错误

时间:2020-09-09 16:01:53

标签: azure-functions

我的队列触发函数显示异常行为。触发后,它会在几分钟后成功完成。

[09.09.2020 15:46:16] Executed 'CalculateStuff' (Succeeded, Id=c56f689a-0a56-4bcf-85ca-080cbbc2b6d0)

此行后大约1分钟,功能应用程序显然引发了错误,因为在终端(在本地运行时)中,由于已达到MaxDequeueCount为1,它显示消息已被移至-poison队列的提示。

[09.09.2020 15:47:03] Message has reached MaxDequeueCount of 1. Moving message to queue 'queue-name-poison'.

我明确选择此值为1(默认值为5),因为该函数内部的一部分将请求上载到外部sftp服务器,然后轮询以进行回复。这可能需要5分钟。如果MaxDequeueCount> 1并且出现错误,则此过程会发生多次,这不是我想要的。

但是令我感到困惑的是,函数本身成功完成了,而结束仍然以某种方式抛出了异常。我不知道这是哪里来的。您有什么想法吗?

非常感谢您的帮助!

Hosting environment: Development
Content root path: C:\Users\name\source\functionApp\bin\output
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.

Http Functions:

        Starter: [POST] http://localhost:7071/api/sl2/new

[09.09.2020 15:40:42] Host lock lease acquired by instance ID '00000000000000000000000041CA841C'.
[09.09.2020 15:40:48] Executing HTTP request: {
[09.09.2020 15:40:48]   "requestId": "732c5eed-8e45-46e0-9760-bcbd91ecdbee",
[09.09.2020 15:40:48]   "method": "POST",
[09.09.2020 15:40:48]   "uri": "/api/sl2/new"
[09.09.2020 15:40:48] }
[09.09.2020 15:40:48] Executing 'Starter' (Reason='This function was programmatically called via the host APIs.', Id=87b75e56-1a2e-4344-867e-fb3f063143d4)
[09.09.2020 15:40:48] Executed 'Starter' (Succeeded, Id=87b75e56-1a2e-4344-867e-fb3f063143d4)
[09.09.2020 15:40:48] Executed HTTP request: {
[09.09.2020 15:40:48]   "requestId": "732c5eed-8e45-46e0-9760-bcbd91ecdbee",
[09.09.2020 15:40:48]   "method": "POST",
[09.09.2020 15:40:48]   "uri": "/api/sl2/new",
[09.09.2020 15:40:48]   "identities": [
[09.09.2020 15:40:48]     {
[09.09.2020 15:40:48]       "type": "WebJobsAuthLevel",
[09.09.2020 15:40:48]       "level": "Admin"
[09.09.2020 15:40:48]     }
[09.09.2020 15:40:48]   ],
[09.09.2020 15:40:48]   "status": 202,
[09.09.2020 15:40:48]   "duration": 171
[09.09.2020 15:40:48] }
[09.09.2020 15:40:52] Executing 'CalculateStuff' (Reason='New queue message detected on 'queue-name'.', Id=c56f689a-0a56-4bcf-85ca-080cbbc2b6d0)
[09.09.2020 15:40:52] Trigger Details: MessageId: 630fc042-f61d-4fc2-9dae-c5b22092db14, DequeueCount: 1, InsertionTime: 09.09.2020 15:40:48 +00:00
....
[09.09.2020 15:46:16] Executed 'CalculateStuff' (Succeeded, Id=c56f689a-0a56-4bcf-85ca-080cbbc2b6d0)
[09.09.2020 15:47:03] Message has reached MaxDequeueCount of 1. Moving message to queue 'queue-name-poison'. 

0 个答案:

没有答案