Class GrpcClient

java.lang.Object
io.stargate.sdk.grpc.GrpcClient
All Implemented Interfaces:
io.stargate.sdk.api.ApiConstants

public class GrpcClient extends Object implements io.stargate.sdk.api.ApiConstants
Wrapping the HttpClient and provide helpers
Author:
Cedrick LUNVEN (@clunven)
  • Field Details

    • retryConfig

      protected com.evanlennick.retry4j.config.RetryConfig retryConfig
      Default retry configuration.
    • apiInvocationsObserversMap

      protected static Map<String,io.stargate.sdk.audit.ServiceCallObserver> apiInvocationsObserversMap
      Observers.
  • Method Details

    • getInstance

      public static GrpcClient getInstance()
      Singleton Pattern.
      Returns:
      singleton for the class
    • setRetryConfig

      public void setRetryConfig(com.evanlennick.retry4j.config.RetryConfig retryConfig)
      Set value for retryConfig
      Parameters:
      retryConfig - new value for retryConfig
    • execute

      public ResultSetGrpc execute(ServiceGrpc sGrpc, QueryGrpc query, String token)
      Execute a request coming from elsewhere.
      Parameters:
      sGrpc - gRPC service
      query - gRPC query
      token - authentication token
      Returns:
      service response
    • executeBatch

      public ResultSetGrpc executeBatch(ServiceGrpc sGrpc, BatchGrpc batch, String token)
      Execute a batch coming from elsewhere.
      Parameters:
      sGrpc - gRPC service
      batch - gRPC query
      token - authentication token
      Returns:
      service response
    • executeAsync

      public CompletableFuture<ResultSetGrpc> executeAsync(ServiceGrpc sGrpc, QueryGrpc query, String token)
      Execute a request coming from elsewhere.
      Parameters:
      sGrpc - gRPC service
      query - gRPC query
      token - authentication token
      Returns:
      service response
    • executeBatchAsync

      public CompletableFuture<ResultSetGrpc> executeBatchAsync(ServiceGrpc sGrpc, BatchGrpc batch, String token)
      Execute a request coming from elsewhere.
      Parameters:
      sGrpc - gRPC service
      batch - gRPC batch
      token - authentication token
      Returns:
      service response
    • executeReactive

      public reactor.core.publisher.Mono<ResultSetGrpc> executeReactive(ServiceGrpc sGrpc, QueryGrpc query, String token)
      Execute a reactive query.
      Parameters:
      sGrpc - gRPC service
      query - gRPC query
      token - authentication token
      Returns:
      service response
    • executeBatchReactive

      public reactor.core.publisher.Mono<ResultSetGrpc> executeBatchReactive(ServiceGrpc sGrpc, BatchGrpc batch, String token)
      Execute a reactive query.
      Parameters:
      sGrpc - gRPC service
      batch - gRPC batch
      token - authentication token
      Returns:
      service response
    • registerListener

      public static void registerListener(String name, io.stargate.sdk.audit.ServiceCallObserver listener)
      Register a new listener.
      Parameters:
      name - current name
      listener - current listener