2017-02-11 56 views
1
工作

我Azure的功能有两个输入参数:输入绑定到自定义类似乎并不为BLOB

  • 事件触发轮毂
  • 一滴输入结合

我试图绑定这两个参数都是自定义类型(在我的情况下是F#记录)。结合精品工程为触发,而不是博客的结合,它提供了以下错误:

Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.MailboxFanOut'. 
Microsoft.Azure.WebJobs.Host: Can't bind Blob to type 'Run+CustomerName'. 

下面是代码:

[<CLIMutable>] 
type CustomerName = { 
    UserName: string 
} 

let Run(item: CustomerName, userNames: CustomerName, log: TraceWriter) = 
    log.Verbose("F# function executing") 

一类不利于更换F#记录.. 。

下面是函数的定义:

{ 
    "bindings": [ 
    { 
     "type": "eventHubTrigger", 
     "name": "item", 
     "direction": "in", 
     "path": "blabla", 
     "connection": "eventhubs", 
     "consumerGroup": "$Default" 
    }, 
    { 
     "type": "blob", 
     "name": "userNames", 
     "path": "tada/123", 
     "connection": "foo", 
     "direction": "in" 
    } 
    ], 
    "disabled": false 
} 

回答

2

团块绑定不幸d目前不支持您期望的POCO绑定。我们在回购跟踪here中有一个公开问题。

为了解决这个问题,我建议绑定到Stream,字符串或其他支持的类型之一,并在您的方法中将反序列化转换为您的POCO类型。

+0

啊,谢谢,很高兴知道。该文档说他们支持https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob P.S. github问题中的“SO问题”链接被破坏,它指向自己 – Mikhail

+0

是的,我还记录了一个文档错误:) https://github.com/Azure/Azure-Functions/issues/180。我们会修复它:) – mathewc

+0

更好地修复SDK;) – Mikhail