CordaRPCConnection
Keywords: net.corda.client.rpc.CordaRPCConnection class
Date: 2023-09-18

net.corda.client.rpc

## Class CordaRPCConnection

- net.corda.client.rpc.CordaRPCConnection

- All Implemented Interfaces:
    RPCConnection<I>

      public class CordaRPCConnection
      implements RPCConnection<I>

  This class is essentially just a wrapper for an `RPCConnection` and can be treated identically.

  See Also:
    `interface RPCConnection`

- - ### Field Detail

    - #### Companion

          public static net.corda.client.rpc.CordaRPCConnection.Companion Companion

  - ### Method Detail

    - #### getProxy

          @NotNull
          public CordaRPCOps getProxy()

      Holds a synthetic class that automatically forwards method calls to the server, and returns the response.

    - #### getServerProtocolVersion

          public int getServerProtocolVersion()

      The RPC protocol version reported by the server.

    - #### notifyServerAndClose

          public void notifyServerAndClose()

      Closes this client gracefully by sending a notification to the server, so it can immediately clean up resources. If the server is not available this method may block for a short period until it's clear the server is not coming back.

      Note: this will also be the implementation of `close` so won't be needed when using use or `try-with-resources` blocks.

      See Also:
        `close`, use

    - #### forceClose

          public void forceClose()

      Closes this client without notifying the server.

      The server will eventually clear out the RPC message queue and disconnect subscribed observers, but this may take longer than desired, so to conserve resources you should normally use `notifyServerAndClose`. This method is helpful when the node may be shutting down or have already shut down and you don't want to block waiting for it to come back, which typically happens in integration tests and demos rather than production.

      See Also:
        `notifyServerAndClose`

    - #### getTelemetryHandle

          @Nullable
          public <T> T getTelemetryHandle(@NotNull
                                                    java.lang.Class<T> telemetryClass)

      Returns the configured openTelemetry global. Returns null if opentelemetry has not been configured.