GetNewStartingFailoverClient Method
GetNewStartingFailoverClient(Action<HazelcastFailoverOptions>, CancellationToken)
Gets a new starting IHazelcastClient instance in failover mode with configured options.
Declaration
public static HazelcastClientStart GetNewStartingFailoverClient(Action<HazelcastFailoverOptions> configure, CancellationToken cancellationToken = default)
Parameters
Action<HazelcastFailoverOptions> | configure | A HazelcastFailoverOptions configuration delegate. |
CancellationToken | cancellationToken | A optional cancellation token. |
Returns
HazelcastClientStart | A HazelcastClientStart instance which exposes the IHazelcastClient itself, along with a Task representing the start operation. |
Remarks
The IHazelcastClient instance is starting, but not started yet. Its start operation is represented by the returned Task, which will complete when the client has started, or when starting has failed. Trying to use the client before the start Task has completed can have unspecified results, including throwing exceptions. Make sure that the start Task has actually completed before using the client.
In any case, the start Task must be awaited, as it may fail with an exception that must be observed.
Options are built via the HazelcastFailoverOptionsBuilder.Build() method and passed to
the configure
method,
where they can be refined and adjusted, before being used to create the client.
By default, the client connection timeout is 120 seconds. If this method cannot establish a connection to a cluster at the configured addresses, it may do failover. You may want to configure a timeout via the options.Networking.ConnectionRetry.ClusterConnectionTimeoutMilliseconds configuration option.
GetNewStartingFailoverClient(HazelcastFailoverOptions, CancellationToken)
Gets a new starting IHazelcastClient instance in failover mode with options.
Declaration
public static HazelcastClientStart GetNewStartingFailoverClient(HazelcastFailoverOptions options, CancellationToken cancellationToken = default)
Parameters
HazelcastFailoverOptions | options | Options. |
CancellationToken | cancellationToken | A optional cancellation token. |
Returns
HazelcastClientStart | A HazelcastClientStart instance which exposes the IHazelcastClient itself, along with a Task representing the start operation. |
Remarks
The IHazelcastClient instance is starting, but not started yet. Its start operation is represented by the returned Task, which will complete when the client has started, or when starting has failed. Trying to use the client before the start Task has completed can have unspecified results, including throwing exceptions. Make sure that the start Task has actually completed before using the client.
In any case, the start Task must be awaited, as it may fail with an exception that must be observed.
By default, the client connection timeout is 120 seconds. If this method cannot establish a connection to a cluster at the configured addresses, it may do failover. You may want to configure a timeout via the options.Networking.ConnectionRetry.ClusterConnectionTimeoutMilliseconds configuration option.