Azure / Azure/azure-functions-java-library

CosmosDB Outputbinding does not work for multiple documents

オープン
#109 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area:java-functions
主要言語
Java
スター
45
フォーク
49
PR マージ指標
30日以内にマージされた PR はありません

説明

We have a simple function which is triggered by event hub and simply forwards messages to cosmosDB using the cosmosDB output binding.
It works well if we receive and forward one message.
However it does not work when we receive and forward a list of messages using Cardinality.many.
Example:
```
public void run(
@EventHubTrigger(
name = "ConsumeDeviceMessages2",
eventHubName = "@eventhub.name@",
connection = "@iothub.connection@",
consumerGroup = CONSUMER_GROUP,
cardinality = Cardinality.MANY)
List messages,

@CosmosDBOutput(
name = "outputDocument",
databaseName = "@cosmosdb.name@",
collectionName = "@cosmosdb.collection.name@",
connectionStringSetting = "@cosmosdb.connection.appsetting@")
OutputBinding> outputDocument,

final ExecutionContext context) {
outputDocument.setValue(messages);
}
```
If this is triggered an error occurs:

`[Error] Executed 'Functions.SaveIotDeviceMessages' (Failed, Id=a845d74b-861a-40e7-a6f2-f5b7032b2cf2)Value cannot be null.Parameter name: document`

Configuration seems pretty basic and works on another function where we forward multiple messages to a queue instead.

Any idea why it is not working for cosmosDB? The documentation states its working for .NET and Javascript, no information about Java though.

Thanks and regards.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず、EventHubTrigger Cardinality.MANY と CosmosDBOutput を使用し、OutputBinding> を使った Java 関数を再現します。Java の CosmosDB output binding が outputDocument.setValue(messages) をどのように処理するかを追跡し、その動作をドキュメントに記載されている .NET および JavaScript のサポートと比較します。Java で複数のドキュメントがサポートされているかを特定し、結果として生じる動作を記録または修正できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
databases
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。