我正在尝试为 Azure 函数 2.0 属性绑定 ServiceBusTrigger 称为:Properties IDictionary 作为输入参数,如下所示:
public static class Function1
{
[FunctionName("Function1")]
public static void Run([ServiceBusTrigger("topic-name", "subscription-name", Connection = "connection-string")]string mySbMsg, string messageId, string correlationId, IDictionary<string,object> properties, ILogger log)
{
log.LogInformation($"C# ServiceBus topic trigger function processed message: {mySbMsg}");
}
}
我有错误:
Microsoft.Azure.WebJobs.Host:索引方法“Function1.Run”时出错。Microsoft.Azure.WebJobs.Host:无法将参数“属性”绑定到类型 IDictionary`2。确保绑定支持参数类型。如果您使用绑定扩展(例如 ServiceBus、Timers 等),请确保您已在启动代码中调用了扩展的注册方法(例如 config.UseServiceBus()、config.UseTimers() 等) .)
作为我使用的来源:https : //docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus文档。
MessageId 和 CorrelationId 工作正常。如何获取:Properties IDictionary<< String,Object >>应用程序特定的消息属性?
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句