具有计时器触发器和 Blob 触发器的连续 Web 作业

Continuous Web Job with timer trigger and Blob trigger

我在使用 azure jobs sdk 及其扩展的同一 Web 作业控制台应用程序中具有以下功能。定时触发器查询文件的 API 端点,对其进行一些额外的工作,然后将文件保存到名为 blahinput 的 blob。现在第二种方法 "ProcessBlobMessage" 应该识别 blahinput 中的新 blob 文件并对其进行处理。

public static void  ProcessBlobMessage([BlobTrigger("blahinput/{name}")] TextReader input,
        string name, [Blob("foooutput/{name}")] out string output)
    {//do something        }

    public static void QueryAnAPIEndPointToGetFile([TimerTrigger("* */1 * * * *")] TimerInfo timerInfo) { // download a file and save it to blob named blah input}

这里的问题是: 当我将上述 Web 作业部署为连续时,似乎只有计时器触发的事件被触发,而应该识别新文件的功能永远不会被触发。在同一个网络作业中不可能有两个这样的触发器吗?

来自这篇文章:How to use Azure blob storage with the WebJobs SDK

The WebJobs SDK scans log files to watch for new or changed blobs. This process is not real-time; a function might not get triggered until several minutes or longer after the blob is created. In addition, storage logs are created on a "best efforts" basis; there is no guarantee that all events will be captured. Under some conditions, logs might be missed. If the speed and reliability limitations of blob triggers are not acceptable for your application, the recommended method is to create a queue message when you create the blob, and use the QueueTrigger attribute instead of the BlobTrigger attribute on the function that processes the blob.

在发布新的 blob 触发策略之前,BlobTriggers 并不可靠。触发器基于 Azure 存储分析日志,它以尽力而为的方式存储日志。 正在进行 Github issue about this and there is also a PR regarding a new Blob scanning strategy.

话虽如此,请检查您是否在可能导致 BlobTriggers 出现问题的早期版本上使用 Latest Webjobs SDK version 1.1.1 because there was an issue