【问题标题】:Using Azure Function as output for Stream Analytics: Connection Test Fails使用 Azure Function 作为流分析的输出:连接测试失败
【发布时间】:2019-07-26 18:36:28
【问题描述】:

我有一个使用 Azure 函数作为输出的 Azure 流分析作业。我通过 CI/CD 部署 ASA 作业和功能。当我部署 ASA 作业(假设 AF 存在)时,部署成功并且作业成功启动。此外,AF 被成功触发(即输出正常,这不是问题,例如与 TSL 设置有关 -> Connection Test Failed when trying to add an Azure function as an output sink to Stream Analytics Job)。

不过,当我进行连接测试时它失败了:

为什么连接测试失败?

【问题讨论】:

    标签: azure azure-functions azure-stream-analytics


    【解决方案1】:

    在测试连接的健康状况时,会从 ASA 向 AF 发送一个空批次。问题是我正在处理空批次,返回 500 响应最终导致连接测试失败。

    为了避免这个问题,有必要实现另一种处理空批次的方法:

    // Get and deserialize input content
    string content = await req.Content.ReadAsStringAsync();
    dynamic asaInput = JsonConvert.DeserializeObject(content);
    
    // Handle empty input
    if (asaInput is null || asaInput.Count == 0)
    {
        log.Info("Received an empty request body...");
        return req.CreateResponse(HttpStatusCode.NoContent);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-08
      • 2021-01-28
      • 2018-05-14
      相关资源
      最近更新 更多