CosmosItemResponse cosmosItemResponse = container.createItem(messages.get(0));
List<CosmosItemOperation> cosmosItemOperations = new ArrayList<>();
for (Message message : messages) {
cosmosItemOperations.add(CosmosBulkOperations.getCreateItemOperation(message, new PartitionKey(message.getEngagementId())));
}
Iterable<CosmosBulkOperationResponse<Message>> iterable = container.executeBulkOperations(cosmosItemOperations);
}
`
Note: CosmosItemResponse cosmosItemResponse = container.createItem(messages.get(0));
is working and able to create the item in cosmos. Which means the container object is fine and working. It fails on the execute bulk operation part.
Error:
16:50:39.104 [bulk-executor-bounded-elastic-9] ERROR com.azure.cosmos.implementation.batch.BulkExecutor -- HandleTransactionalBatchOperationResult - Fail, PKRange 0, Response Status Code 200, Operation Status Code -1, ItemOperation[Type: CREATE, PK: ["c8ad54fb-043d-4749-911c-2846bbd8c081"], id: null], Context: BulkExecutor-1[n/a] Thread[Name: bulk-executor-bounded-elastic-9,Group: main, isDaemon: true, Id: 58]
` private void bulkCreateItems(List messages) {