Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ private void initializeDBConnection(String connUrl) throws Exception
.endpoint(maccountEndpoint)
.key(maccountKey)
.consistencyLevel(ConsistencyLevel.EVENTUAL)
.contentResponseOnWriteEnabled(true)
//.contentResponseOnWriteEnabled(true) Disabled for performance
.preferredRegions(Collections.singletonList(mregion))
.connectionSharingAcrossClientsEnabled(true)
.buildAsyncClient();

cosmosDatabase = cosmosClient.getDatabase(mdatabase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.genexus.util.NameValuePair;
import json.org.json.JSONException;
import json.org.json.JSONObject;
import reactor.core.Disposable;
import reactor.core.publisher.Mono;

import java.io.InputStream;
Expand Down Expand Up @@ -45,7 +46,7 @@ public class CosmosDBPreparedStatement extends ServicePreparedStatement
super(con, parms, gxCon);
this.query = query;
this.cursor = cursor;
getCointainer(query.tableName);
getContainer(query.tableName);
}
@Override
public ResultSet executeQuery() throws SQLException
Expand Down Expand Up @@ -135,7 +136,7 @@ private int _executeQuery(CosmosDBResultSet resultSet) throws Exception {
CosmosAsyncDatabase getDatabase() throws SQLException {
return ((CosmosDBConnection)getConnection()).cosmosDatabase;
}
private void getCointainer(String containerName) throws SQLException {
private void getContainer(String containerName) throws SQLException {
container = getDatabase().getContainer(containerName);
}

Expand Down Expand Up @@ -223,8 +224,9 @@ private int[] deleteDocument(String idValue, Object partitionKey) throws Excepti
statusCode[0] = 404;
latch.countDown();
});
cosmosItemResponseMono.subscribe();
Disposable d = cosmosItemResponseMono.subscribe();
latch.await();
d.dispose();
return statusCode;
}
else
Expand Down Expand Up @@ -259,9 +261,9 @@ private int[] createDocument(JSONObject jsonObject, Object partitionKey) throws
latch.countDown();
});

cosmosItemResponseMono.subscribe();
Disposable d = cosmosItemResponseMono.subscribe();
latch.await();

d.dispose();
return statusCode;
} else {
throw new Exception("CosmosDB Insert Execution failed. Invalid json payload.");
Expand Down Expand Up @@ -296,8 +298,9 @@ private int[] replaceDocument(JSONObject jsonObject, String idValue , Object par
latch.countDown();
});

cosmosItemResponseMono.subscribe();
Disposable d = cosmosItemResponseMono.subscribe();
latch.await();
d.dispose();
return statusCode;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<junit.version>4.13.2</junit.version>
<com.amazonaws.version>1.12.376</com.amazonaws.version>
<software.awssdk.version>2.17.272</software.awssdk.version>
<software.azure.cosmos.version>4.41.0</software.azure.cosmos.version>
<software.azure.cosmos.version>4.42.0</software.azure.cosmos.version>
<log4j.version>2.19.0</log4j.version>
<io.opentelemetry.version>1.19.0</io.opentelemetry.version>
</properties>
Expand Down