Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk operation is not working #69

Open
mjaiswal17 opened this issue Jun 19, 2024 · 1 comment
Open

Bulk operation is not working #69

mjaiswal17 opened this issue Jun 19, 2024 · 1 comment

Comments

@mjaiswal17
Copy link

` private void bulkCreateItems(List messages) {

    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]
@mjaiswal17
Copy link
Author

Env:
Java 17 with Spring boot 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant