Click or drag to resize
ProviderSession Class
This class provides a session that can be used for providing services.
Inheritance Hierarchy

Namespace:  Bloomberglp.Blpapi
Assembly:  Bloomberglp.Blpapi (in Bloomberglp.Blpapi.dll) Version: 3.12.5.1
Syntax
public sealed class ProviderSession : AbstractSession

The ProviderSession type exposes the following members.

Constructors
  NameDescription
Public methodProviderSession
Construct provider session with no options, event handler or event dispatcher. ProviderSession(SessionOptions, ProviderEventHandler, EventDispatcher)
Public methodProviderSession(SessionOptions)
The constructor with SessionOptions
Public methodProviderSession(SessionOptions, ProviderEventHandler)
The constructor with SessionOptions and ProviderEventHandler
Public methodProviderSession(SessionOptions, ProviderEventHandler, EventDispatcher)
Constructs a Session using the optionally specified 'options', the optionally specified 'eventHandler' and the optionally specified 'eventDispatcher'.

See the SessionOptions documentation for details on what can be specified in the 'options'.

If 'eventHandler' is not null then this Session will operation 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 amongst 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, partial response to a request or updates to a single subscription. If 'eventHandler' is null and the 'eventDispatcher' is not null an exception is thrown. 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.

Top
Methods
  NameDescription
Public methodActivateSubServiceCodeRange
Activates sub-service code range of the specified [begin, end] and the specified priority to an already registered service.

Numerically greater values of priority indicate higher priorities.The behavior is undefined unless begin, end and priority are between 0 and 2^24 (2 to the power of 24) and the service has already been registered.

Public methodCancel(CorrelationID)
Cancels an outstanding request or a subscription represented by the specified correlationId.
(Inherited from AbstractSession.)
Public methodCancel(IListCorrelationID)
Cancels outstanding requests or subscriptions represented by the specified list of correlationIds.
(Inherited from AbstractSession.)
Public methodCancel(CorrelationID, String)
Cancels an outstanding request or a subscription represented by the specified correlationId.
(Inherited from AbstractSession.)
Public methodCancel(IListCorrelationID, String)
Cancels outstanding requests or subscriptions represented by the specified list of correlationIds.
(Inherited from AbstractSession.)
Public methodCreateIdentity
Returns a new Identity which is valid but has not been authorized.
(Inherited from AbstractSession.)
Public methodCreateTopic Obsolete.
Creates a new Topic object based on the specified 'message'. The 'message' must be one of the following types: SUBSCRIPTION_STARTED, SUBSCRIPTION_STOPPED, RECAP or RESOLUTION_SUCCESS. If the 'message' is not valid then invoking isValid() on the returned Topic will return false.
Public methodCreateTopics(TopicList)
Creates the topics in the specified 'topicList' and updates the 'topicList' with the results of the resolution and creation process.
Public methodCreateTopics(TopicList, ResolveMode)
Creates the topics in the specified 'topicList' and updates the 'topicList' with the results of the resolution and creation process.
Public methodCreateTopics(TopicList, ResolveMode, Identity)
Creates the topics in the specified 'topicList' and updates the 'topicList' with the results of the resolution and creation process.
Public methodCreateTopicsAsync(TopicList)
Begins the creation of the topics in the specified 'topicList'.
Public methodCreateTopicsAsync(TopicList, ResolveMode)
Begins the creation of the topics in the specified 'topicList'.
Public methodCreateTopicsAsync(TopicList, ResolveMode, Identity)
Begins the creation of the topics in the specified 'topicList'.
Public methodCreateUserHandle Obsolete. (Inherited from AbstractSession.)
Public methodDeactivateSubServiceCodeRange
De-activates sub-service code range specified by [begin, end] from to an already registered service. The behavior is undefined unless 'begin' and 'end' are between 0 and 2^24 (2 to the power of 24) and the service has already been registered.
Public methodDeleteTopic
Removes one reference from the specified 'topic'.
Public methodDeleteTopics
Deletes each topic in the specified 'topics'.
Public methodDeregisterService
Deregisters the service identified by the specified 'uri'.
Public methodGenerateToken
Return a generated token to be used for authorization.
(Inherited from AbstractSession.)
Public methodGenerateToken(CorrelationID)
Return a generated token to be used for authorization.
(Inherited from AbstractSession.)
Public methodGenerateToken(CorrelationID, EventQueue)
Return a generated token to be used for authorization.
(Inherited from AbstractSession.)
Public methodGenerateToken(String, String, CorrelationID, EventQueue)
Return a generated token to be used for authorization.
(Inherited from AbstractSession.)
Public methodGetService
Returns a handle to a Service object representing the service identified by the specified uri.
(Inherited from AbstractSession.)
Public methodGetTopic
Finds a previously created Topic object based on the specified
message
Public methodNextEvent
Returns the next event available for processing on this session.
(Inherited from AbstractSession.)
Public methodNextEvent(Int64)
Returns the next event available for processing on this session.
(Inherited from AbstractSession.)
Public methodOpenService
Opens the service having the specified uri.
(Inherited from AbstractSession.)
Public methodOpenServiceAsync(String)
Issues an asynchronous request to open a service.
(Inherited from AbstractSession.)
Public methodOpenServiceAsync(String, CorrelationID)
Initiates an asynchronous request to open a service.
(Inherited from AbstractSession.)
Public methodPublish
Publish the specified 'event'.
Public methodRegisterService(String, Identity)

Attempts to register the service identified by the specified 'uri' and blocks until the service is either registered successfully or has failed to be registered. The specified 'providerIdentity' is used to verify permissions to provide the service being registered. Returns true if the service is registered successfully and false if the service cannot be registered successfully.

The 'uri' must begin with a full qualified service name. That is it must begin with "//{namespace}/{service-name}[/]". Any portion of the 'uri' after the service name is ignored.

This method does not return until a SERVICE_STATUS event has been generated. Note that if the session was created in asynchronous mode, the event may be processed before the function returns.

Public methodRegisterService(String, Identity, ServiceRegistrationOptions)

Attempts to register the service identified by the specified 'uri' and blocks until the service is either registered successfully or has failed to be registered. The specified 'providerIdentity' is used to verify permissions to provide the service being registered. Returns true if the service is registered successfully and false if the service cannot be registered successfully.

The 'uri' must begin with a full qualified service name. That is it must begin with "//{namespace}/{service-name}[/]". Any portion of the 'uri' after the service name is ignored.

This method does not return until a SERVICE_STATUS event has been generated. Note that if the session was created in asynchronous mode, the event may be processed before the function returns.

Public methodRegisterServiceAsync(String, Identity)
Begins the process of registering the service identified by the specified 'uri' with identity and returns immediately.
Public methodRegisterServiceAsync(String, Identity, CorrelationID)
Begins the process of registering the service identified by the specified 'uri' and returns immediately.
Public methodRegisterServiceAsync(String, Identity, ServiceRegistrationOptions)
Begins the process of registering the service identified by the specified 'uri' with identity and registration options, and returns immediately.
Public methodRegisterServiceAsync(String, Identity, CorrelationID, ServiceRegistrationOptions)
Begins the process of registering the service identified by the specified 'uri' with identity, CorrelationID and registration options. Returns immediately.
Public methodResolve(ResolutionList)
Resolves the topics in the specified 'resolutionList' and updates the 'resolutionList' with the results of the resolution process. All services referenced in the topics in the 'resolutionList' must already have been registered using registerService(). Once resolve() returns each entry in the 'resolutionList' will have been updated with a new status.
Public methodResolve(ResolutionList, ResolveMode)
Resolves the topics in the specified 'resolutionList' and updates the 'resolutionList' with the results of the resolution process.
Public methodResolve(ResolutionList, ResolveMode, Identity)
Resolves the topics in the specified 'resolutionList' and updates the 'resolutionList' with the results of the resolution process.
Public methodResolveAsync(ResolutionList)
Begins the resolution of the topics in the specified 'resolutionList'.
Public methodResolveAsync(ResolutionList, ResolveMode)
Begins the resolution of the topics in the specified 'resolutionList'.
Public methodResolveAsync(ResolutionList, ResolveMode, Identity)
Begins the resolution of the topics in the specified 'resolutionList'.
Public methodSendAuthorizationRequest(Request, Identity, CorrelationID)
Sends the specified authorizationRequest and update the specified identity with the results.
(Inherited from AbstractSession.)
Public methodSendAuthorizationRequest(Request, UserHandle, CorrelationID) Obsolete.
Deprecated since 3.3.0.0. Use SendAuthorizationRequest(Request, Identity, CorrelationID)instead.
(Inherited from AbstractSession.)
Public methodSendAuthorizationRequest(Request, Identity, CorrelationID, String)
Sends the specified authorizationRequest and update the specified identity with the results.
(Inherited from AbstractSession.)
Public methodSendAuthorizationRequest(Request, Identity, EventQueue, CorrelationID)
Sends the specified authorizationRequest and update the specified identity with the results.
(Inherited from AbstractSession.)
Public methodSendAuthorizationRequest(Request, UserHandle, CorrelationID, String) Obsolete. (Inherited from AbstractSession.)
Public methodSendAuthorizationRequest(Request, UserHandle, EventQueue, CorrelationID) Obsolete. (Inherited from AbstractSession.)
Public methodSendAuthorizationRequest(Request, Identity, EventQueue, CorrelationID, String)
Sends the specified authorizationRequest and update the specified identity with the results.
(Inherited from AbstractSession.)
Public methodSendAuthorizationRequest(Request, UserHandle, EventQueue, CorrelationID, String) Obsolete. (Inherited from AbstractSession.)
Public methodSendResponse(Event)
Sends the response event for previously received request
Public methodSendResponse(Event, Boolean)
Sends the response event for previously received request
Public methodSetEventHandler
Sets event specific event handlers
Public methodStart
Issues a blocking call to start the session.
(Inherited from AbstractSession.)
Public methodStartAsync
Initiates a non blocking call to start the session.
(Inherited from AbstractSession.)
Public methodStop
Stops this session.
(Inherited from AbstractSession.)
Public methodStop(AbstractSessionStopOption)
Stops the operation of this session.
(Inherited from AbstractSession.)
Public methodTryNextEvent
Tries to retrieve the next event available for processing on this session
(Inherited from AbstractSession.)
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implementationPrivate methodIDisposableDispose
Dispose this Session object. It calls AbstractSession.Stop() to close the opened socket.
(Inherited from AbstractSession.)
Top
Remarks

ProviderSession inherits from AbstractSession. In addition to the AbstractSession functionality, a ProviderSession provides the following functions to applications.

Applications can register to provide Services using either ProviderSession.RegisterService() or ProviderSession.RegisterServiceAsync(). Before registering to provide a Service an application must have established its identity.

After applications have registered a service they will start receiving subscription requests ('TopicSubscribed' message in EventType.TOPIC_STATUS) for topics which belong to the service. If the resolver has specified 'subServiceCode' for topics in 'PermissionResponse', then only providers who have activated the 'subServiceCode' will get the subscription request. Where multiple providers have registered the same service and sub-service code (if any), the provider that registered the highest priority for the sub-service code will receive subscription requests; if multiple providers have registered the same sub-service code with the same priority (or the resolver did not set a sub-service code for the subscription), the subscription request will be routed to one of the providers with the highest service priority.

Topic Life Cycle

A provider wishing to publish subscription data must explicitly open each topic on which they publish using ProviderSession.CreateTopics (or ProviderSession.CreateTopicsAsync). Creating a topic prepares the distribution and caching infrastructure for new data associated with the topic's resolved identifier. (Note that several different topics could resolve to the same ID.) Independent of a topic's creation status is its subscription status, i.e. whether there are subscribers ready to receive the data published. A topic that is both created and subscribed is *activated*.

There are two models for managing topic creation: broadcast and interactive. Broadcast publishers proactively call ProviderSession.CreateTopics for each topic on which they intend to publish, while interactive publishers wait to receive a 'TopicSubscribed' message (within an Event of type Event.EventType.TOPIC_STATUS before calling ProviderSession.CreateTopics in response. Topics are resolved before they are created---it is possible that multiple different topic strings will map to the same underlying topic. See below for the behavior of the SDK when the same topic is created multiple times.

After ProviderSession.CreateTopics is called, the publisher will receive a 'TopicCreated' message (within a Event.EventType.TOPIC_STATUS event), and when there is at least one subscriber to the topic the publisher will then receive a 'TopicActivated' message (also within an Event.EventType.TOPIC_STATUS event). As subscribers come and go, additional 'TopicSubscribed', 'TopicActivated', 'TopicUnsubscribed', and 'TopicDeactivated' messages may be received by the publisher. A Topic object can be retrieved from each of these messages using the ProviderSession.GetTopic method, and this object can be used for subsequent calls to EventFormatter.AppendMessage and ProviderSession.DeleteTopic. In the case that the same resolved topic is created multiple times by a publisher using different names, it is unspecified which of those names will be returned by Message.TopicName for these (or other) messages.

If a publisher no longer intends to publish data on a topic, it can call ProviderSession.DeleteTopic to free the internal caching and distribution resources associated with the topic. When a resolved topic has been deleted the same number of times that it has been created, a 'TopicDeleted' message will be delivered, preceded by 'TopicDeactivated' messages if the topic was still subscribed (and activated). No further messages can be published on a deleted topic.

Deregistering a service deletes all topics associated with that service.

Note that 'TopicActivated' and 'TopicDeactivated' messages are entirely redundant with 'TopicCreated', 'TopicSubscribed', 'TopicDeleted', and 'TopicUnsubscribed' messages, and are provided only for the convenience of publishers that do not maintain per-topic state.

See Also