Click or drag to resize

IContextCreateSession Method

version: 10.23.0
Creates a session instance. Session properties to customize the session, and message receive and the session event delegates must be provided for the session. The message receive delegate is invoked for each received message on this session. The session event delegate is invoked when session events occur, such as the session going up or down. Both delegates are invoked in the context of the context thread to which this session belongs.

Note: disposing the corresponding context (IContext) or any of its contained context timers (TimerTask), sessions (ISession) or flows (IFlow) must not be performed from within the registered delegates (messageEventHandler or sessionEventHandler).

Namespace:  SolaceSystems.Solclient.Messaging
Assembly:  SolaceSystems.Solclient.Messaging (in SolaceSystems.Solclient.Messaging.dll) Version: 10.23.0
ISession CreateSession(
	SessionProperties props,
	EventHandler<MessageEventArgs> messageEventHandler,
	EventHandler<SessionEventArgs> sessionEventHandler


Type: SolaceSystems.Solclient.MessagingSessionProperties
Defined in SessionProperties.
Type: SystemEventHandlerMessageEventArgs
A delegate for delivered messages.
Type: SystemEventHandlerSessionEventArgs
A delegate for session events.

Client applications can call GetLastSDKErrorInfo from within the session event delegate to get more info on the type of error condition reported by SessionEventArgs.

Return Value

Type: ISession
A new ISession instance.
OperationErrorException Thrown when unable to create the session. Possible sub-codes:
ObjectDisposedException Thrown if the context is already disposed (terminal state).
FatalErrorException Thrown when an unrecoverable error occurs.
ArgumentException Thrown when invalid values of SessionProperties property values are detected.
See Also