Class CosmosUtils

java.lang.Object
io.micronaut.data.cosmos.common.CosmosUtils

@Internal public final class CosmosUtils extends Object
The utility class for Cosmos operations, currently used for diagnostic processing and error handling.
Since:
3.9.0
Author:
radovanradic
  • Method Details

    • cosmosAccessException

      public static CosmosAccessException cosmosAccessException(CosmosDiagnosticsProcessor cosmosDiagnosticsProcessor, String operationName, String message, Throwable throwable)
      Returns CosmosAccessException and processes diagnostics if wrapped exception is CosmosException.
      Parameters:
      cosmosDiagnosticsProcessor - the Cosmos response diagnostics processor
      operationName - the operation name
      message - the detail message
      throwable - exception
      Returns:
      CosmosAccessException for operations on Cosmos Db
    • processDiagnostics

      public static void processDiagnostics(CosmosDiagnosticsProcessor cosmosDiagnosticsProcessor, String operationName, @Nullable @Nullable com.azure.cosmos.CosmosDiagnostics cosmosDiagnostics, @Nullable @Nullable String activityId, double requestCharge)
      Processes diagnostics from the Cosmos response.
      Parameters:
      cosmosDiagnosticsProcessor - the Cosmos response diagnostics processor
      operationName - the operation name
      cosmosDiagnostics - the Cosmos diagnostics
      activityId - the activity id (will be null in case of cross partition queries)
      requestCharge - the request charge for the operation