CordaRPCClient.start - corda

corda / net.corda.client.rpc / CordaRPCClient / start

# start

`@JvmOverloads fun start(username: String, password: String, gracefulReconnect: GracefulReconnect? = null): CordaRPCConnection`

Logs in to the target server and returns an active connection. The returned connection is a java.io.Closeable and can be used with a try-with-resources statement. If you don't use that, you should use the RPCConnection.notifyServerAndClose or RPCConnection.forceClose methods to dispose of the connection object when done.

### Parameters

`username` - The username to authenticate with.

`password` - The password to authenticate with.

`gracefulReconnect` - a GracefulReconnect class containing callback logic when the RPC is dis/reconnected unexpectedly

### Exceptions

`RPCException` - if the server version is too low or if the server isn't reachable within a reasonable timeout.

`@JvmOverloads fun start(username: String, password: String, targetLegalIdentity: CordaX500Name, gracefulReconnect: GracefulReconnect? = null): CordaRPCConnection`

Logs in to the target server and returns an active connection. The returned connection is a java.io.Closeable and can be used with a try-with-resources statement. If you don't use that, you should use the RPCConnection.notifyServerAndClose or RPCConnection.forceClose methods to dispose of the connection object when done.

### Parameters

`username` - The username to authenticate with.

`password` - The password to authenticate with.

`targetLegalIdentity` - in case of multi-identity RPC endpoint specific legal identity to which the calls must be addressed.

`gracefulReconnect` - a GracefulReconnect class containing callback logic when the RPC is dis/reconnected unexpectedly

### Exceptions

`RPCException` - if the server version is too low or if the server isn't reachable within a reasonable timeout.

`@JvmOverloads fun start(username: String, password: String, externalTrace: Trace?, impersonatedActor: Actor?, gracefulReconnect: GracefulReconnect? = null): CordaRPCConnection`

Logs in to the target server and returns an active connection. The returned connection is a java.io.Closeable and can be used with a try-with-resources statement. If you don't use that, you should use the RPCConnection.notifyServerAndClose or RPCConnection.forceClose methods to dispose of the connection object when done.

### Parameters

`username` - The username to authenticate with.

`password` - The password to authenticate with.

`externalTrace` - external Trace for correlation.

`impersonatedActor` - the actor on behalf of which all the invocations will be made.

`gracefulReconnect` - a GracefulReconnect class containing callback logic when the RPC is dis/reconnected unexpectedly

### Exceptions

`RPCException` - if the server version is too low or if the server isn't reachable within a reasonable timeout.

`@JvmOverloads fun start(username: String, password: String, externalTrace: Trace?, impersonatedActor: Actor?, targetLegalIdentity: CordaX500Name?, gracefulReconnect: GracefulReconnect? = null): CordaRPCConnection`

Logs in to the target server and returns an active connection. The returned connection is a java.io.Closeable and can be used with a try-with-resources statement. If you don't use that, you should use the RPCConnection.notifyServerAndClose or RPCConnection.forceClose methods to dispose of the connection object when done.

### Parameters

`username` - The username to authenticate with.

`password` - The password to authenticate with.

`externalTrace` - external Trace for correlation.

`impersonatedActor` - the actor on behalf of which all the invocations will be made.

`targetLegalIdentity` - in case of multi-identity RPC endpoint specific legal identity to which the calls must be addressed.

`gracefulReconnect` - a GracefulReconnect class containing callback logic when the RPC is dis/reconnected unexpectedly. Note that when using graceful reconnect the values for CordaRPCClientConfiguration.connectionMaxRetryInterval and CordaRPCClientConfiguration.maxReconnectAttempts will be overridden in order to mangage the reconnects.

### Exceptions

`RPCException` - if the server version is too low or if the server isn't reachable within a reasonable timeout.