Class DeephavenClusterConnection

java.lang.Object
io.deephaven.enterprise.dnd.client.DeephavenClusterConnection

public class DeephavenClusterConnection extends Object
An object that maintains connections to Deephaven services on a remote cluster. This is used by the Java Client to create and subscribe to queries, and also used by Core+ workers to connect to queries on different clusters.
  • Constructor Details

    • DeephavenClusterConnection

      public DeephavenClusterConnection(@NotNull @NotNull String connectionUrl) throws IOException
      Create a new, unauthenticated connection to the specified Deephaven cluster. Users should call one of password(String, String), privateKey(String) or delegateToken(AuthToken) to authenticate with the server before accessing the provided services.
      Parameters:
      connectionUrl - the url of the remote system in the format `https://server-address:port/iris/connection.json`
      Throws:
      IOException - if there is a problem establishing a connection to the remote cluster.
  • Method Details

    • close

      public void close()
      Close all connections to the remote host.
    • password

      public boolean password(@NotNull @NotNull String user, @NotNull @NotNull String password)
      Authenticate with the server using a username and password
      Parameters:
      user - the username
      password - the password
      Returns:
      true if successfully authenticated, false otherwise.
    • privateKey

      public boolean privateKey(@NotNull @NotNull String keyFile)
      Authenticate to the server using a private key file.
      Parameters:
      keyFile - the private key file
      Returns:
      true if successfully authenticated, false otherwise.
    • delegateToken

      public boolean delegateToken(@NotNull @NotNull io.deephaven.enterprise.auth.AuthToken delegateToken)
      Use a delegate token to authenticate.
      Parameters:
      delegateToken - the token to authenticate with
      Returns:
      true if successfully authenticated, false otherwise.
    • setMaxInboundMessageSize

      public void setMaxInboundMessageSize(int maxInboundMessageSize)
      Set the maximum inbound message size for connections created by this object.
      Parameters:
      maxInboundMessageSize - the new max inbound message size
    • getControllerClient

      public io.deephaven.enterprise.controller.client.ControllerClientGrpc getControllerClient()
      Get the controller client for the cluster. The controller client will automatically be authenticated when any of the authentication methods have completed successfully.
      Returns:
      the ControllerClientGrpc
    • getAuthenticationClient

      public io.deephaven.enterprise.auth.AuthenticationClient getAuthenticationClient()
      Get the AuthenticationClient for the cluster.
      Returns:
      the authentication client
    • getExecutor

      public ScheduledExecutorService getExecutor()
      Get the ScheduledExecutorService used for connections created by this object.
      Returns:
      the ScheduledExecutorService
    • getUserContext

      public io.deephaven.enterprise.auth.UserContext getUserContext() throws io.deephaven.enterprise.auth.NotAuthenticatedException
      Get the authenticated UserContext for this object.
      Returns:
      the authenticated UserContext
      Throws:
      io.deephaven.enterprise.auth.NotAuthenticatedException - if this connection has not been authenticated
    • makeGrpcChannel

      public io.grpc.ManagedChannel makeGrpcChannel(@NotNull @NotNull String host, int port, @Nullable @Nullable Map<String,String> extraHeaders) throws IOException
      Construct a gRPC channel for communication with the Persistent Query
      Parameters:
      host - the host of the query
      port - the port of the query
      extraHeaders - a map of any extra HTTP headers to include, or null if none.
      Returns:
      a new ManagedChannel for communication with the Persistent Query
      Throws:
      IOException - if there was a problem creating the channel