10.25.0

ISessionConnect Method

Connects the specified session. A session connection can be carried out in a blocking or non-blocking mode, depending upon the session property ConnectBlocking.

In blocking mode, the calling thread is blocked until either the session connection attempt succeeds or is determined to have failed. If the connection succeeds, SOLCLIENT_OK is returned. If the session could not connect, SOLCLIENT_NOT_READY is returned.

In non-blocking mode, SOLCLIENT_IN_PROGRESS is returned upon a successful session connect request, and the connection attempt proceeds in the background. In both non-blocking and blocking mode, a session event is generated for the session: UpNotice, if the session successfully connects; or ConnectFailedError, if the session fails to connect.

For blocking mode, the session event is issued before the call to Connect returns. For non-blocking mode, the timing is undefined (that is, it could occur before or after the call returns, but it is typically after). A session connection timer, controlled by the session property ConnectTimeoutInMsecs, controls the maximum amount of time a session connect attempt lasts for. If this amount time is exceeded, a ConnectFailedError event is issued for the session.

If there is an error when Connect is invoked, SOLCLIENT_FAIL is returned, and a session event is not subsequently issued. Therefore, the caller must check for a return code of SOLCLIENT_FAIL if it has logic that depends upon a subsequent session event to be issued. For a non-blocking session connect invocation, if the session connect attempt eventually fails, the last error information to indicate the reason for the failure cannot be determined by the calling thread, rather it must be discovered through the session event delegate (and GetLastSDKErrorInfo can be called in the session event delegate to get further information). For a blocking session connect invocation, if the session connect attempt does not return SOLCLIENT_OK, then the calling thread can determine the failure reason by immediately calling GetLastSDKErrorInfo.

Definition

Namespace: SolaceSystems.Solclient.Messaging
Assembly: SolaceSystems.Solclient.Messaging (in SolaceSystems.Solclient.Messaging.dll) Version: 10.25.0
C#
ReturnCode Connect()

Return Value

ReturnCode
When successful it returns SOLCLIENT_IN_PROGRESS if ConnectBlocking is false or SOLCLIENT_OK otherwise.

Exceptions

OperationErrorException Thrown when the Connect operation fails. Possible sub-codes:
ObjectDisposedException Thrown when the session is already disposed (terminal state).
FatalErrorException Thrown when an unrecoverable error occurs.

See Also