【发布时间】:2014-08-18 13:51:59
【问题描述】:
我在使用新的 0.3.0-beta WebJobs SDK 的 WebJob 中有以下逻辑。当我的代码无法处理消息时,Azure 仪表板会显示一个聚合异常(这是有道理的,因为这是异步的)。但是,它不会重试处理该消息。
我能找到的极少documentation 表明该消息应在失败后10 分钟内重试。新的 SDK 不是这样吗?
public static Task ProcessMyMessageAsync(
[QueueTrigger(Config.MY_QUEUE)] string msg,
int dequeueCount,
CancellationToken cancellationToken)
{
var processor = Config.Container.GetInstance<IMessageProcessor>();
return processor.HandleJobAsync(msg, dequeueCount, cancellationToken);
}
我得到的异常源于 SQL 超时异常(在我的代码中它是针对 SQL Azure 的数据库查询):
System.AggregateException: System.AggregateException: One or more errors occurred.
---> System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details.
---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
---> System.ComponentModel.Win32Exception: The wait operation timed out
【问题讨论】:
-
失败是发生在绑定阶段还是函数内部?你能详细说明你得到了什么例外吗?
-
@VictorHurdugaci 该异常似乎与 JobHost 或类似的东西无关。它肯定在我的代码中,因为它是 SQL 超时,所以我希望重试该消息。
标签: azure-web-app-service azure-webjobs azure-webjobssdk