Solclient
IContextCreateSession Method |
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: 7.2.1.27 (7.2.1.27)
Syntax
ISession CreateSession( SessionProperties props, EventHandler<MessageEventArgs> messageEventHandler, EventHandler<SessionEventArgs> sessionEventHandler )
Function CreateSession ( props As SessionProperties, messageEventHandler As EventHandler(Of MessageEventArgs), sessionEventHandler As EventHandler(Of SessionEventArgs) ) As ISession
ISession^ CreateSession( SessionProperties^ props, EventHandler<MessageEventArgs^>^ messageEventHandler, EventHandler<SessionEventArgs^>^ sessionEventHandler )
Parameters
- props
- Type: SolaceSystems.Solclient.MessagingSessionProperties
Defined in SessionProperties. - messageEventHandler
- Type: SystemEventHandlerMessageEventArgs
A delegate for delivered messages. - sessionEventHandler
- 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: ISessionA new ISession instance.
Exceptions
Exception | Condition |
---|---|
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. |
See Also