Search in sources :

Example 11 with CustomPOJO

use of com.azure.cosmos.examples.common.CustomPOJO in project azure-cosmos-java-sql-api-samples by Azure-Samples.

the class SampleDocumentationSnippets method PerformanceTipsJavaSDKv4RequestChargeSpecAsync.

/**
 * https://docs.microsoft.com/en-us/azure/cosmos-db/performance-tips-java-sdk-v4-sql
 * Performance tips - get request charge
 */
/**
 * Performance tips - get request charge
 */
public static void PerformanceTipsJavaSDKv4RequestChargeSpecAsync() {
    CosmosContainer syncContainer = null;
    CustomPOJO item = null;
    // <PerformanceRequestChargeSync>
    CosmosItemResponse<CustomPOJO> response = syncContainer.createItem(item);
    response.getRequestCharge();
// </PerformanceRequestChargeSync>
}
Also used : CosmosContainer(com.azure.cosmos.CosmosContainer) CustomPOJO(com.azure.cosmos.examples.common.CustomPOJO)

Example 12 with CustomPOJO

use of com.azure.cosmos.examples.common.CustomPOJO in project azure-cosmos-java-sql-api-samples by Azure-Samples.

the class SampleDocumentationSnippets method PerformanceTipsJavaSDKv4NoPKSpecSync.

/**
 * https://docs.microsoft.com/en-us/azure/cosmos-db/performance-tips-java-sdk-v4-sql
 * Performance tips - not specifying partition key in point-writes
 */
/**
 * Performance tips - not specifying partition key in point-writes
 */
public static void PerformanceTipsJavaSDKv4NoPKSpecSync() {
    CosmosContainer syncContainer = null;
    CustomPOJO item = null;
    String pk = "pk_value";
    // <PerformanceNoPKSync>
    syncContainer.createItem(item, new PartitionKey(pk), new CosmosItemRequestOptions());
// </PerformanceNoPKSync>
}
Also used : CosmosItemRequestOptions(com.azure.cosmos.models.CosmosItemRequestOptions) CosmosContainer(com.azure.cosmos.CosmosContainer) PartitionKey(com.azure.cosmos.models.PartitionKey) CustomPOJO(com.azure.cosmos.examples.common.CustomPOJO)

Aggregations

CustomPOJO (com.azure.cosmos.examples.common.CustomPOJO)12 CosmosAsyncContainer (com.azure.cosmos.CosmosAsyncContainer)8 PartitionKey (com.azure.cosmos.models.PartitionKey)4 CosmosContainer (com.azure.cosmos.CosmosContainer)3 CosmosItemRequestOptions (com.azure.cosmos.models.CosmosItemRequestOptions)3 CosmosItemResponse (com.azure.cosmos.models.CosmosItemResponse)3 ChangeFeedProcessor (com.azure.cosmos.ChangeFeedProcessor)2 ChangeFeedProcessorBuilder (com.azure.cosmos.ChangeFeedProcessorBuilder)2 CosmosStoredProcedureRequestOptions (com.azure.cosmos.models.CosmosStoredProcedureRequestOptions)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ArrayList (java.util.ArrayList)2 ExecutorService (java.util.concurrent.ExecutorService)2 Scheduler (reactor.core.scheduler.Scheduler)2 ProxyOptions (com.azure.core.http.ProxyOptions)1 ConsistencyLevel (com.azure.cosmos.ConsistencyLevel)1 CosmosAsyncClient (com.azure.cosmos.CosmosAsyncClient)1 CosmosAsyncDatabase (com.azure.cosmos.CosmosAsyncDatabase)1 CosmosClientBuilder (com.azure.cosmos.CosmosClientBuilder)1 DirectConnectionConfig (com.azure.cosmos.DirectConnectionConfig)1