マスタ タイトルの書式設定
16
© Recruit Co., Ltd.
Interacting with Azure Cosmos DB using Cosmos SDK
// 飛行機の搭乗情報の例
// Create an item
cosmosAsyncContainer.createItem(new Passenger(”
[email protected]", ”Yuji Masaoka", ”HND", ”KCZ"))
.flatMap(response -> {
System.out.println("Created item: " + response.getItem());
// Read that item
return cosmosAsyncContainer.readItem(response.getItem().getId(),
new PartitionKey(response.getItem().getId()), Passenger.class);
})
.flatMap(response -> {
System.out.println("Read item: " + response.getItem());
// Replace that item
Passenger p = response.getItem();
p.setDestination(“CTS”); // 新千歳空港行きに変更
return cosmosAsyncContainer.replaceItem(p, response.getItem().getId(),
new PartitionKey(response.getItem().getId()));
})
// delete that item
.flatMap(response -> cosmosAsyncContainer.deleteItem(response.getItem().getId(),
new PartitionKey(response.getItem().getId())
));