到Azure Blob存储的Azure存储队列消息

时间:2020-05-27 17:06:19

标签: azure azure-storage-queues

我可以使用提供给我的连接字符串(不是我创建的队列)访问Azure存储队列。消息每分钟发送一次。我要接收所有消息并将其放入Azure Blob存储中。

我的问题是我没有成功从附加的存储队列中获取消息。进行此数据存储的“最简单”方法是什么?

我尝试使用Logic Apps访问外部队列,然后尝试将其放入我自己的队列中,然后再将其移至Blob存储,但是运气不佳。

1 个答案:

答案 0 :(得分:0)

如果要访问逻辑应用程序中的外部存储,则需要存储帐户的名称和密钥。

您必须为天蓝色队列选择触发器,然后单击“手动输入连接信息”。

在下一步中,您将能够选择要收听的队列。 enter image description here

enter image description here

enter image description here

我建议您使用和azure函数,类似于本文中的内容:

https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob-output?tabs=csharp

可以尝试只读取消息,然后添加创建blob的输出:

     [FunctionName("GetMessagesFromQueue")]
     public IActionResult GetMessagesFromQueue(
    [QueueTrigger("%ExternalStorage.QueueName%", Connection = "ExternalStorage.StorageConnection")ModelMessage modelmessage,
    [Blob("%YourStorage.ContainerName%/{id}", FileAccess.Write, Connection = "YourStorage.StorageConnection")] Stream myBlob)
    {
        //put the modelmessage into the stream
    }

您不仅可以绑定到Stream,还可以绑定很多类型。在链接中,您拥有所有信息。

希望我能帮上忙