简体   繁体   English

Azure powershell function 如何将消息添加到存储帐户队列

[英]Azure powershell function how to add message to storage account queue

I have the basic Azure function and in the integration I have defined trigger as Azure storage queue and parameter name as queueItem.我有基本的 Azure function,在集成中我将触发器定义为 Azure 存储队列,将参数名称定义为 queueItem。 Likewise I have set output as Azure storage queue and parameter name as outputQueueItem.同样,我将 output 设置为 Azure 存储队列,并将参数名称设置为 outputQueueItem。 Function is triggered when I get message to my inputqueue but I cannot get the message to outputqueue.当我将消息发送到输入队列但无法将消息发送到输出队列时,将触发 Function。

param([string] $QueueItem, $TriggerMetadata)
Write-Host "PowerShell queue trigger function processed work item: $QueueItem"
Write-Host "Queue item insertion time: $($TriggerMetadata.InsertionTime)"

$outputQueueItem = $QueueItem

I have tried with "$outputQueueItem.Add($QueueItem)" but none of these work.我尝试过使用“$outputQueueItem.Add($QueueItem)”,但这些都不起作用。 What is the correct way on using the output? output的正确使用方法是什么?

You can try in my way, it works fine on my side:您可以按照我的方式尝试,它在我这边很好用:

run.ps1 :运行.ps1

# Input bindings are passed in via param block.
param([string] $QueueItem, $TriggerMetadata)

# Write out the queue message and insertion time to the information log.
Write-Host "PowerShell queue trigger function processed work item: $QueueItem"
Write-Host "Queue item insertion time: $($TriggerMetadata.InsertionTime)"

Push-OutputBinding -Name outputQueueItem -Value $QueueItem

function.json : function.json :

{
  "bindings": [
    {
      "name": "QueueItem",
      "type": "queueTrigger",
      "direction": "in",
      "queueName": "ps-queue-items",
      "connection": "AzureWebJobsStorage"
    },
    {
      "type": "queue",
      "name": "outputQueueItem",
      "queueName": "outqueue",
      "connection": "AzureWebJobsStorage",
      "direction": "out"
    }
  ],
  "disabled": false
}

On my side, the message in ps-queue-items trigger the function and will output the same message to outqueue.在我这边,ps-queue-items 中的消息触发 function 并将 output 相同的消息出队。

Have a look of this Offcial doc:看看这个官方文档:

https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-powershell#writing-output-data https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-powershell#writing-output-data

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure队列存储消息未保存到正确的队列中 - Azure Queue Storage message not getting saved in the right queue On Azure Function azure function powershell从存储队列中读取并写入存储表 - azure function powershell read from storage queue and write to storage table 如何在Azure存储队列的开头插入消息? - How to insert message at the beginning of an Azure storage queue? C#-Azure函数:调用“ HTTP触发器” Azure函数时如何将消息记录到队列存储中? - C#-Azure function:How to log message to Queue storage when calling to “HTTP Trigger” azure function? 当 Azure 表存储更新时,将消息添加到 Azure 队列 - Add Message to Azure Queue when Azure Table Storage is updated Azure计划程序:将JSON消息添加到Azure存储队列 - Azure scheduler: Add JSON message to Azure Storage Queue 如何从 Azure 存储队列的消息文本字段中读取 JSON 字符串(使用 Azure 函数)? - How do I read a JSON string from the Message Text field in an Azure Storage queue (using an Azure function)? 带有PowerShell,存储队列触发器和OneDrive for Business的Azure功能 - Azure Function with PowerShell, Storage Queue trigger, and OneDrive for Business Azure功能和存储队列 - Azure Function and storage queue Azure 存储队列消息到 Azure Blob 存储 - Azure Storage Queue message to Azure Blob Storage
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM