私はAzureポータルで作成したAzure関数を持っており、VS2017プレビューに関連付けられているビジュアルスタジオの空白ツールを使用して再作成します。DocumentDB入力をAzure関数にバインドする方法は?
私の関数はTimerであり、Azure DocumentDBの入力バインディング(クエリ付き)とAzure Service Busキューへの出力バインディングもあります。
ここではポータルからfunctions.json
定義です:
public static void Run([TimerTrigger("0 */5 * * * *")] TimerInfo myTimer, TraceWriter log, ICollector<dynamic> outputQueue, IEnumerable<dynamic> incomingDocuments)
{
log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
//Inspect incomingDocuments .. push messages to outputQueue
}
、タイマー:VS2017で
{
"bindings": [
{
"name": "myTimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */5 * * * *"
},
{
"type": "serviceBus",
"name": "outputQueue",
"queueName": "test-output-requests",
"connection": "send-refresh-request",
"accessRights_": "Send",
"direction": "out"
},
{
"type": "documentDB",
"name": "incomingDocuments",
"databaseName": "test-db-dev",
"collectionName": "TestingCollection",
"sqlQuery": "select * from c where c.docType = \"Test\"",
"connection": "my-testing_DOCUMENTDB",
"direction": "in"
}
],
"disabled": false
}
私はAzureの機能プロジェクト、TimerTriggeredテンプレートを使用して、その後Azureの機能を作成し、期待どおりに起動されますが、コード内の入出力バインディングを再作成するにはどうすればよいですか?私は、どの属性を使うべきか、また、json設定ファイルで必要なものを配線するために必要なものがわからない。
おかげで生成されたfunction.jsonを確認してください。 2つの追加情報: [Microsoft.Azure.WebJobs.Extensions.DocumentDB]のv1.1.0-beta1を参照する必要がありました(https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.DocumentDB /)pkg。 'ServiceBus'属性のバインディングに' function.json'の定義が正しくないシリアル化バグがあり、そのNuGet pkgへの更新を待っています.GitHub [issue](https://github.com/Azure/azure)を参照してください。 -functions-vs-build-sdk/issues/40) –
さらにpkgのアップデートは、[available](https://www.nuget.org/packages/Microsoft.NET.Sdk.Functions/1.0.0-alpha4)でServiceBusの問題の修正。 –