corda / net.corda.client.rpc / GracefulReconnect

GracefulReconnect

class GracefulReconnect

GracefulReconnect provides the opportunity to perform certain logic when the RPC encounters a connection disconnect during communication with the node.

NOTE: The callbacks provided may be executed on a separate thread to that which called the RPC command.

Parameters

onDisconnect - implement this callback to perform logic when the RPC disconnects on connection disconnect

onReconnect - implement this callback to perform logic when the RPC has reconnected after connection disconnect

maxAttempts - the maximum number of attempts per each individual RPC call. A negative number indicates infinite number of retries. The default value is 5.

Constructors

<init>

GracefulReconnect(onDisconnect: Runnable, onReconnect: Runnable, maxAttempts: Int = 5)GracefulReconnect(onDisconnect: () -> Unit = {}, onReconnect: () -> Unit = {}, maxAttempts: Int = 5)

GracefulReconnect provides the opportunity to perform certain logic when the RPC encounters a connection disconnect during communication with the node.

Properties

maxAttempts

val maxAttempts: Int

the maximum number of attempts per each individual RPC call. A negative number indicates infinite number of retries. The default value is 5.

onDisconnect

val onDisconnect: () -> Unit

implement this callback to perform logic when the RPC disconnects on connection disconnect

onReconnect

val onReconnect: () -> Unit

implement this callback to perform logic when the RPC has reconnected after connection disconnect

Extension Functions

contextLogger

fun Any.contextLogger(): Logger

When called from a companion object, returns the logger for the enclosing class.