[英]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.