Azure / Azure/azure-functions-java-library
@CosmosDBInput ignores partitionKey
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 45
- フォーク
- 49
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
In my Micronaut Azure Function I am using a binding @CosmosDBInput for event-sourcing like this:
public class ChatRoomFunction extends AzureFunction {
@FunctionName("handleCommand")
public HttpResponseMessage handleCommand(
@HttpTrigger(
name = "req",
methods = HttpMethod.POST,
authLevel = AuthorizationLevel.ANONYMOUS)
final HttpRequestMessage<Command> request,
@CosmosDBInput(
name = "events",
connectionStringSetting = CONNECTION_STRING,
databaseName = DATABASE_NAME,
collectionName = "events",
partitionKey = "events--{id}") final List<Event> events,
final ExecutionContext context
) {
// function body intentionally left out
}
}
// with
public class Command {
private UUID id;
// more fields, getters, setters
}
// and
public class Event {
private String streamId; // this is the CosmosDB partition key
// more fields, getters, setters
}
Before, I tried doing this using @TableInput which seemed to worked fine.
Now I've switched to CosmosDB and for some reason it seems to ignore my @CosmosDBInput's partitionKey value.
Expected: events should contain a list of only Events having a certain streamId as matched by the binding parameter of the request body, i.e. id.
Actual: events contains a list of ALL Events present in the events collection.
Am I missing something here? This is what the partitionKey is for, right?
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
handleCommand の @CosmosDBInput アノテーションから始め、partitionKey の値がリクエストボディからどのように解決されるかを追跡します。events コレクションを使った例を再現し、その後、binding が要求された streamId でフィルタリングするかどうかを確認します。binding が一致するイベントのみを返すか、サポートされる動作を明確に文書化できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- azure, java
- 領域
- backend, cloud
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100