Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
服务总线的Azure函数绑定_Azure_Azure Functions_Azureservicebus - Fatal编程技术网

服务总线的Azure函数绑定

服务总线的Azure函数绑定,azure,azure-functions,azureservicebus,Azure,Azure Functions,Azureservicebus,下面我将为服务总线队列创建一个触发器 我希望能够访问邮件属性。我想我可以简单地将字典属性添加到参数列表中,如下所示: public static void Run( [ServiceBusTrigger(QueueName, Connection = "connectionSetting")] // Message message, string myQueueItem, Int32 deliveryCount, D

下面我将为服务总线队列创建一个触发器

我希望能够访问邮件属性。我想我可以简单地将
字典属性
添加到参数列表中,如下所示:

public static void Run(
        [ServiceBusTrigger(QueueName, Connection = "connectionSetting")]
        // Message message,
        string myQueueItem,
        Int32 deliveryCount,
        DateTime enqueuedTimeUtc,
        string messageId,
        string ContentType,
        Dictionary<string,object> properties,
        TraceWriter log)
公共静态无效运行(
[ServiceBusTrigger(QueueName,Connection=“connectionSetting”)]
//消息消息,
字符串myQueueItem,
Int32 deliveryCount,
日期时间排队时间UTC,
字符串messageId,
字符串内容类型,
字典属性,
TraceWriter日志)
但这意味着:

索引方法“Program.Run”时出错。Microsoft.Azure.WebJobs.Host: 无法将参数“properties”绑定到类型字典“2”。确保 绑定支持参数类型

下面是一些可能的参数绑定。我做错了什么

更新:

我试着把信号改成

public static void Run(
        [ServiceBusTrigger(QueueName, Connection = "connectionSetting")]
        // Message message,
        string myQueueItem,
        Int32 deliveryCount,
        DateTime enqueuedTimeUtc,
        string messageId,
        string ContentType,
        IDictionary<string, object> properties,
        TraceWriter log)
公共静态无效运行(
[ServiceBusTrigger(QueueName,Connection=“connectionSetting”)]
//消息消息,
字符串myQueueItem,
Int32 deliveryCount,
日期时间排队时间UTC,
字符串messageId,
字符串内容类型,
索引属性,
TraceWriter日志)
它会产生相同的错误:

索引方法“Program.Run”时出错。Microsoft.Azure.WebJobs.Host: 无法将参数“属性”绑定到IDictionary类型


对于function v2 runtime,参数名称已更改为
UserProperties

要修复错误,请将参数更新为以下值:

IDictionary<string, object> UserProperties
IDictionary用户属性
以下是服务总线扩展的相关代码


我已经查看了我的函数(V1),它在所有绑定参数中都运行良好。我的是V2-可能是一个bug?是的,它是,请参见以下链接:如何使用
MessageSender
添加UserProperties?
public static void Run(
        [ServiceBusTrigger(QueueName, Connection = "connectionSetting")]
        Message message,
        string label,
        Int32 deliveryCount,       
        DateTime enqueuedTimeUtc,  
        string messageId,
        string ContentType, 
        ILogger log)
    {           
        log.LogInformation($"C# ServiceBus queue trigger function processed message: {Encoding.UTF8.GetString(message.Body)}");
        var userProperties = message.UserProperties;
    }
IDictionary<string, object> UserProperties