<tfoot id='2VxPQ'></tfoot>

<small id='2VxPQ'></small><noframes id='2VxPQ'>

    <bdo id='2VxPQ'></bdo><ul id='2VxPQ'></ul>
<i id='2VxPQ'><tr id='2VxPQ'><dt id='2VxPQ'><q id='2VxPQ'><span id='2VxPQ'><b id='2VxPQ'><form id='2VxPQ'><ins id='2VxPQ'></ins><ul id='2VxPQ'></ul><sub id='2VxPQ'></sub></form><legend id='2VxPQ'></legend><bdo id='2VxPQ'><pre id='2VxPQ'><center id='2VxPQ'></center></pre></bdo></b><th id='2VxPQ'></th></span></q></dt></tr></i><div id='2VxPQ'><tfoot id='2VxPQ'></tfoot><dl id='2VxPQ'><fieldset id='2VxPQ'></fieldset></dl></div>

<legend id='2VxPQ'><style id='2VxPQ'><dir id='2VxPQ'><q id='2VxPQ'></q></dir></style></legend>

    1. 将多个 Blob 输入传递给 QueueTrigger Azure 函数的最佳方式

      时间:2023-10-25

        <i id='TIqfZ'><tr id='TIqfZ'><dt id='TIqfZ'><q id='TIqfZ'><span id='TIqfZ'><b id='TIqfZ'><form id='TIqfZ'><ins id='TIqfZ'></ins><ul id='TIqfZ'></ul><sub id='TIqfZ'></sub></form><legend id='TIqfZ'></legend><bdo id='TIqfZ'><pre id='TIqfZ'><center id='TIqfZ'></center></pre></bdo></b><th id='TIqfZ'></th></span></q></dt></tr></i><div id='TIqfZ'><tfoot id='TIqfZ'></tfoot><dl id='TIqfZ'><fieldset id='TIqfZ'></fieldset></dl></div>
          <bdo id='TIqfZ'></bdo><ul id='TIqfZ'></ul>

          1. <small id='TIqfZ'></small><noframes id='TIqfZ'>

                <tbody id='TIqfZ'></tbody>
              <legend id='TIqfZ'><style id='TIqfZ'><dir id='TIqfZ'><q id='TIqfZ'></q></dir></style></legend>
              • <tfoot id='TIqfZ'></tfoot>
                本文介绍了将多个 Blob 输入传递给 QueueTrigger Azure 函数的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                触发后,生成 3 个 XML 文件,完成后,将它们 ftp 到一个站点.

                Upon a trigger, generate 3 XML files and once complete, ftp them to a site.

                我有一个 HTTP 触发器 Azure 函数,它在运行时会构造 3 个 XML 文件并将这些文件保存到 Azure 存储 Blob 容器.由于有多个输出,并且需要控制输出路径/文件名,我使用势在必行绑定方法 并在我的函数中使用 IBinder outputBinder.这一切都很好.Blob 存储中的输出路径示例是 export/2017-03-22/file-2017-03-22T12.03.02.54.xml.文件在一个有日期的文件夹里,每个文件名都有时间戳,保证唯一性.

                I have a HTTP Trigger Azure function that when run will construct 3 XML files and save these to an Azure Storage Blob container. Because of the multiple outputs, and the need to control the output path/filenames, I use the imperative binding approach and use the IBinder outputBinder in my function. This all works just fine. An example of the output path in the blob storage is export/2017-03-22/file-2017-03-22T12.03.02.54.xml. The file is in a folder with the date, and each filename has the time stamp to ensure uniqueness.

                当所有 3 个文件都生成后,我想触发另一个函数,将这些文件通过 sFTP 发送到站点.现在我最初认为我应该使用 blob 触发器,但我不知道如何触发文件名和路径是动态的输入.我在 blob 触发器文档.

                When all 3 files are generated, I want to trigger another function that will sFTP these to a site. Now I initially thought that I should use a blob trigger, but I couldn't figure how how to trigger on inputs that whose filenames and paths were dynamic. I coudldn't find such an example in the blob trigger documentation.

                然后我想我可以将我的 HTTP 触发器输出到声明性绑定,并将 XML 文件输出到我的 blob 存储中的 outgoing 容器中,我的 blob 触发器可以查看该容器.但是,这也有效,因为我的功能在消费计划中,最多可以有一个 每天 10 分钟处理新 blob.

                So then I thought I could have my HTTP Trigger output to a declarative binding and also output the XML files into an outgoing container in my blob storage which my blob trigger could be looking at. This also works however because my function is on the consumption plan, there can be up to a 10-minute day in processing new blobs.

                因此记录在案的替代方法是使用队列触发器.我可以输出到我的队列并很好地触发队列,但是如何将 3 个 XML 流也传递给我的 QueueTrigger 函数?

                So the documented alternative is to use a queue trigger. I can output to my queue and have the queue trigger just fine, but how do I also pass the 3 XML streams to my QueueTrigger function?

                我想作为后备,我可以发布一个可以包含构建 XML 的 Azure 存储路径的对象,然后使用存储 SDK 获取流并使用它发布到 FTP,但它会更多吗将这些存储 Blob 流作为输入传递给我的 QueueTrigger 是否有效?

                I suppose as a fall back, I can post an object that can contain the Azure Storage paths of the constructed XMLs and then use the Storage SDK to fetch the streams and use that to post to the FTP, but would it be more efficient to also pass those Storage Blob streams as an input to my QueueTrigger?

                推荐答案

                我认为您使用 Queue Trigger 的方法很有意义.我会构建这样的消息

                I think your approach with Queue Trigger makes sense. I would construct a message like this

                public class QueueItem
                {
                    public string FirstBlobPath { get; set; }
                    public string SecondBlobPath { get; set; }
                    public string ThirdBlobPath { get; set; }
                }
                

                然后在队列处理函数中使用声明式绑定,类似

                and then use declarative binding in the queue processing function, something like

                {
                  "bindings": [
                    {
                      "type": "queueTrigger",
                      "name": "item",
                      "direction": "in",
                      "queueName": "myqueue",
                      "connection":"...",    
                    },
                    {
                      "type": "blob",
                      "name": "file1",
                      "path": "mycontainer/{FirstBlobPath}",
                      "connection": "...",
                      "direction": "in"
                    },
                    {
                      "type": "blob",
                      "name": "file2",
                      "path": "mycontainer/{SecondBlobPath}",
                      "connection": "...",
                      "direction": "in"
                    },
                    {
                      "type": "blob",
                      "name": "file3",
                      "path": "mycontainer/{ThirdBlobPath}",
                      "connection": "...",
                      "direction": "in"
                    }
                  ],
                  "disabled": false
                }
                

                和功能

                public static void Run(QueueItem item, Stream file1, Stream file2, Stream file3)
                {
                }
                

                这篇关于将多个 Blob 输入传递给 QueueTrigger Azure 函数的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:当 SQL 数据库添加新行而不进行轮询时,C# Azure 函数触发器 下一篇:在 Azure Functions 应用程序 blobtrigger 中设置 blob 的内容类型

                相关文章

                <tfoot id='J2jGq'></tfoot><legend id='J2jGq'><style id='J2jGq'><dir id='J2jGq'><q id='J2jGq'></q></dir></style></legend>

                1. <small id='J2jGq'></small><noframes id='J2jGq'>

                    • <bdo id='J2jGq'></bdo><ul id='J2jGq'></ul>
                  1. <i id='J2jGq'><tr id='J2jGq'><dt id='J2jGq'><q id='J2jGq'><span id='J2jGq'><b id='J2jGq'><form id='J2jGq'><ins id='J2jGq'></ins><ul id='J2jGq'></ul><sub id='J2jGq'></sub></form><legend id='J2jGq'></legend><bdo id='J2jGq'><pre id='J2jGq'><center id='J2jGq'></center></pre></bdo></b><th id='J2jGq'></th></span></q></dt></tr></i><div id='J2jGq'><tfoot id='J2jGq'></tfoot><dl id='J2jGq'><fieldset id='J2jGq'></fieldset></dl></div>