【问题标题】:how to get the dequeue count in azure functions with powershell如何使用 powershell 在 azure 函数中获取出队计数
【发布时间】:2018-02-14 12:14:41
【问题描述】:

我已经使用 powershell 实现了一个 azure 存储队列触发的 azure 函数。 现在我正在寻找一种解决方案来读取队列项的出队计数以实现错误处理功能。 对于 C#,我从 MS 中找到了一些解决方案,但对于 PS 却没有。

#r "Microsoft.WindowsAzure.Storage"

using Microsoft.WindowsAzure.Storage.Queue;
using System;

public static void Run(CloudQueueMessage myQueueItem, 
DateTimeOffset expirationTime, 
DateTimeOffset insertionTime, 
DateTimeOffset nextVisibleTime,
string queueTrigger,
string id,
string popReceipt,
int dequeueCount,
TraceWriter log)
{
log.Info($"C# Queue trigger function processed: {myQueueItem.AsString}\n" +
    $"queueTrigger={queueTrigger}\n" +
    $"expirationTime={expirationTime}\n" +
    $"insertionTime={insertionTime}\n" +
    $"nextVisibleTime={nextVisibleTime}\n" +
    $"id={id}\n" +
    $"popReceipt={popReceipt}\n" + 
    $"dequeueCount={dequeueCount}");
}

BR

【问题讨论】:

  • 请贴出你找到的C#解决方案。

标签: powershell azure azure-functions azure-storage-queues


【解决方案1】:

出队计数作为“绑定数据”推送。 (每个触发器都有自己唯一的特定于该触发器的绑定数据。)在 C# 中,绑定数据可以直接绑定到参数,这就是上面示例有效的原因。在 Powershell 中,绑定数据通过环境变量传递。检查你的环境变量,你应该看到这些。 (这里有一个很好的 HTTP 示例:https://blogs.technet.microsoft.com/stefan_stranger/2017/01/29/powershell-azure-functions-lessons-learned/

【讨论】:

  • 我已经检查并测试了您之前提到的博客文章中的脚本。 env 没有变量:在我的队列中触发了 azure 函数...
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-09-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多