Azure-Samples / azure-cosmos-java-sql-api-samples

Sample code for Azure Cosmos DB Java SDK for SQL API
MIT License
40 stars 72 forks source link

CosmosStoredProcedureRequestOptions. setIfMatchETag(eTag) is not working. #33

Open SanjayDasTezpur opened 2 years ago

SanjayDasTezpur commented 2 years ago

if the etag is mismatched, still executes the store proc successfully

` public void executeStoredProc(Item item) {

CosmosStoredProcedureRequestOptions options = new CosmosStoredProcedureRequestOptions();
options.setIfMatchETag(item.getEtag());
options.setPartitionKey(new PartitionKey(partitionKey));
List<Object> params = Arrays.asList(new ObjectMapper().writeValueAsString(item));
try {
    CosmosStoredProcedureResponse executeResponse = container.getScripts()
            .getStoredProcedure(updateInvstStoredProcId)
            .execute(params, options);
    if (null != executeResponse) {
        return executeResponse.getResponseAsString();
    }
} catch (Exception e) {
    log.error(e);
}

} `