Bloomberg API for .NET
Session Class
NamespacesBloomberglp.BlpapiSession
This class provides a session for making requests and subscriptions to services.
Declaration Syntax
C#Visual BasicVisual C++
public class Session : AbstractSession
Public Class Session
	Inherits AbstractSession
public ref class Session : public AbstractSession
Members
All MembersConstructorsMethods



IconMemberDescription
Session()()()()
Session(SessionOptions)
Creates a session with the specified sessionOptions.
Remarks
Values in sessionOptions are used for configuring this session.

Session(SessionOptions, EventHandler)
Creates a session with the specified sessionOptions and dispatch events on this session to the specified handlerValues in sessionOptions are used for configuring this session. The event handler to which all events are delivered.

Session(SessionOptions, EventHandler, EventDispatcher)
Creates a session with the specified sessionOptions and dispatch events on this session using the provided dispatcher to the specified handler
Remarks
See SessionOptions for information on what options can be specified.

If the specified eventHandler is not null then this Session will operate in asynchronous mode, otherwise the Session will operate in Synchronous mode.

If eventDispatcher is null then the Session will create a default EventDispatcher for this Session which will use a single thread for dispatching events. For more control over event dispatching a specific instance of EventDispatcher can be supplied. This can be used to share a single EventDispatcher among multiple Session objects.

If an eventDispatcher is supplied which uses more than one thread the Session will ensure that events which should be ordered are passed to callbacks in a correct order. For example, updates to a single subscription.

Each EventDispatcher uses its own thread or pool of threads so if you want to ensure that a session which receives very large messages and takes a long time to process them does not delay a session that receives small messages and processes each one very quickly then give each one a separate EventDispatcher.

Values in sessionOptions are used for configuring this session. The event handler to which all events are delivered. The dispatcher to be used for dispatching events.

Cancel(CorrelationID)
Cancels an outstanding request or a subscription represented by the specified correlationId.
(Inherited from AbstractSession.)
Cancel(CorrelationID, String)
Cancels an outstanding request or a subscription represented by the specified correlationId.
(Inherited from AbstractSession.)
Cancel(IList<(Of <<'(CorrelationID>)>>))
Cancels outstanding requests or subscriptions represented by the specified list of correlationIds.
(Inherited from AbstractSession.)
Cancel(IList<(Of <<'(CorrelationID>)>>), String)
Cancels outstanding requests or subscriptions represented by the specified list of correlationIds.
(Inherited from AbstractSession.)
CreateIdentity()()()()
Returns a new Identity which is valid but has not been authorized.
(Inherited from AbstractSession.)
CreateUserHandle()()()() Obsolete. (Inherited from AbstractSession.)
DispatchEvent(Event) (Inherited from AbstractSession.)
IDisposable..::..Dispose()()()()
Dispose this Session object. It calls AbstractSession.Stop() to close the opened socket.
(Inherited from AbstractSession.)
GenerateToken(CorrelationID, EventQueue)
Return a generated token to be used for authorization.
(Inherited from AbstractSession.)
GenerateToken(CorrelationID)
Return a generated token to be used for authorization.
(Inherited from AbstractSession.)
GenerateToken()()()()
Return a generated token to be used for authorization.
(Inherited from AbstractSession.)
GetService(String)
Returns a handle to a Service object representing the service identified by the specified uri.
(Inherited from AbstractSession.)
GetSubscriptions()()()()
Returns an enumerable collection for iterating over the subscriptions.

GetSubscriptionStatus(CorrelationID)
Returns the subscription status for the specified correlationId.

GetSubscriptionString(CorrelationID)
Returns the subscription string for the specified correlationId.

Init(SessionOptions, EventDispatcher, Boolean) (Inherited from AbstractSession.)
NextEvent()()()()
Returns the next event available for processing on this session.
(Inherited from AbstractSession.)
NextEvent(Int64)
Returns the next event available for processing on this session.
(Inherited from AbstractSession.)
OpenService(String)
Opens the service having the specified uri.
(Inherited from AbstractSession.)
OpenServiceAsync(String)
Issues an asynchronous request to open a service.
(Inherited from AbstractSession.)
OpenServiceAsync(String, CorrelationID)
Initiates an asynchronous request to open a service.
(Inherited from AbstractSession.)
Resubscribe(IList<(Of <<'(Subscription>)>>))
Modifies each subscription in the specified subscriptionList to reflect the modified options specified for it.

Resubscribe(IList<(Of <<'(Subscription>)>>), String)
Modifies each subscription in the specified subscriptionList to reflect the modified options specified for it.

Resubscribe(IList<(Of <<'(Subscription>)>>), Int32)
Modifies each subscription in the specified subscriptionList to reflect the modified options specified for it.

Resubscribe(IList<(Of <<'(Subscription>)>>), Int32, String)
Modifies each subscription in the specified subscriptionList to reflect the modified options specified for it.

SendAuthorizationRequest(Request, Identity, CorrelationID)
Sends the specified authorizationRequest and update the specified identity with the results.
(Inherited from AbstractSession.)
SendAuthorizationRequest(Request, UserHandle, CorrelationID) Obsolete. (Inherited from AbstractSession.)
SendAuthorizationRequest(Request, Identity, CorrelationID, String)
Sends the specified authorizationRequest and update the specified identity with the results.
(Inherited from AbstractSession.)
SendAuthorizationRequest(Request, UserHandle, CorrelationID, String) Obsolete. (Inherited from AbstractSession.)
SendAuthorizationRequest(Request, Identity, EventQueue, CorrelationID)
Sends the specified authorizationRequest and update the specified identity with the results.
(Inherited from AbstractSession.)
SendAuthorizationRequest(Request, UserHandle, EventQueue, CorrelationID) Obsolete. (Inherited from AbstractSession.)
SendAuthorizationRequest(Request, Identity, EventQueue, CorrelationID, String)
Sends the specified authorizationRequest and update the specified identity with the results.
(Inherited from AbstractSession.)
SendAuthorizationRequest(Request, UserHandle, EventQueue, CorrelationID, String) Obsolete. (Inherited from AbstractSession.)
SendRequest(Request, CorrelationID)
Sends the specified request to a service using this session.

SendRequest(Request, CorrelationID, String)
Sends the specified request to a service using this session.

SendRequest(Request, Identity, CorrelationID)
Sends the specified request to a service using this session.

SendRequest(Request, UserHandle, CorrelationID) Obsolete.
SendRequest(Request, Identity, CorrelationID, String)
Sends the specified request to a service using this session.

SendRequest(Request, UserHandle, CorrelationID, String) Obsolete.
SendRequest(Request, EventQueue, CorrelationID)
Sends the specified request to a service using this session.

SendRequest(Request, EventQueue, CorrelationID, String)
Sends the specified request to a service using this session.

SendRequest(Request, Identity, EventQueue, CorrelationID)
Sends the specified request to a service using this session.

SendRequest(Request, UserHandle, EventQueue, CorrelationID) Obsolete.
SendRequest(Request, Identity, EventQueue, CorrelationID, String)
Sends the specified request to a service using this session.

SendRequest(Request, UserHandle, EventQueue, CorrelationID, String) Obsolete.
SetEventHandler(EventHandler, Event..::..EventType)
Set event specific event handlers

Start()()()()
Issues a blocking call to start the session.
(Inherited from AbstractSession.)
StartAsync()()()()
Initiates a non blocking call to start the session.
(Inherited from AbstractSession.)
Stop()()()()
Stops this session.
(Inherited from AbstractSession.)
Stop(AbstractSession..::..StopOption)
Stops the operation of this session.
(Inherited from AbstractSession.)
Subscribe(IList<(Of <<'(Subscription>)>>))
Initiates a request to receive asynchronous updates to the specified topics.

Subscribe(IList<(Of <<'(Subscription>)>>), String)
Initiates a request to receive asynchronous updates to the specified topics.

Subscribe(IList<(Of <<'(Subscription>)>>), Identity)
Initiates a request to receive asynchronous updates to the specified topics.

Subscribe(IList<(Of <<'(Subscription>)>>), UserHandle) Obsolete.
Subscribe(IList<(Of <<'(Subscription>)>>), Identity, String)
Initiates a request to receive asynchronous updates to the specified topics in the subscriptionList.

Subscribe(IList<(Of <<'(Subscription>)>>), UserHandle, String) Obsolete.
TryNextEvent()()()()
Tries to retrieve the next event available for processing on this session
(Inherited from AbstractSession.)
Unsubscribe(CorrelationID) Obsolete.
Cancels a previous request for asynchronous topic updates associated with the specified correlationId.

Unsubscribe(IList<(Of <<'(Subscription>)>>))
Cancels previous requests for asynchronous topic updates associated with the correlation ids listed in the specified subscriptionList.

Unsubscribe(IList<(Of <<'(Subscription>)>>), String)
Cancels previous requests for asynchronous topic updates associated with the correlation ids listed in the specified subscriptionList.

Remarks

Sessions manage access to services either by requests and responses or subscriptions. A Session can dispatch events and replies in either a synchronous or asynchronous mode. The mode of a Session is determined when it is constructed and cannot be changed subsequently.

A Session is asynchronous if an EventHandler object is supplied whenit is constructed. The SetEventHandler() method may be called to adjust the way events are handled subsequently and the NextEvent() method may not be called. All incoming events are delivered to the EventHandler(s) supplied on construction or subsequently using SetEventHandler().

A Session is synchronous if an EventHandler object is not supplied when it is constructed. The NextEvent() method must be called to read incoming events and the SetEventHandler() method may not be called. Several methods in Session take a CorrelationID parameter. The application may choose to supply its own CorrelationID values or allow the Session to create values. If the application supplies its own CorrelationID values it must manage their lifetime such that the same value is not reused for more than one operation at a time. The lifetime of a CorrelationID begins when it is supplied in a method invoked on a Session and ends either when it is explicitly cancelled using Cancel(CorrelationID), when a Event.EventType.RESPONSE Event (not a PARTIAL_RESPONSE) containing it is received or when a Event.EventType.SUBSCRIPTION_STATUS Event which indicates that the subscription it refers to has been terminated is received.

When using an asynchronous Session the application must be aware that because the callbacks are generated from another thread they may be processed before the call which generates them has returned. For example, the Event.EventType.SESSION_STATUS Event generated by the StartAsync()()()() may be processed before StartAsync() has returned (even though StartAsync() itself will not block).

This becomes more significant when Session generated CorrelationIds are in use. For example, if a call to Subscribe() which returns a Session generated CorrelationID has not completed before the first Events which contain that CorrelationID arrive the application may not be able to interpret those events correctly. For this reason, it is preferable to use user generated CorrelationIDs when using asynchronous Sessions. This issue does not arise when using a synchronous Session as long as the calls to Subscribe() etc are made on the same thread as the calls to NextEvent().

Thread Safety
Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.
Thread Safety
Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.
Inheritance Hierarchy

Assembly: Bloomberglp.Blpapi (Module: Bloomberglp.Blpapi.dll) Version: 3.9.6.1