com.bloomberglp.blpapi
Class Session

java.lang.Object
  extended by com.bloomberglp.blpapi.AbstractSession
      extended by com.bloomberglp.blpapi.Session

public class Session
extends AbstractSession

This class provides a session for making requests and subscriptions to services

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 when it is constructed. The setEventHandler() method may be called to adjust the way events are handled subsequently and the AbstractSession.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 AbstractSession.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 canceled using AbstractSession.cancel(CorrelationID) or unsubscribe(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 AbstractSession.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().

Author:
Siva Somu (ssomu)

Nested Class Summary
static class Session.SubscriptionStatus
          SubscriptionStatus lists the possible statuses a Subscription may be in.
 
Nested classes/interfaces inherited from class com.bloomberglp.blpapi.AbstractSession
AbstractSession.StopOption
 
Constructor Summary
Session()
          Same as calling Session(SessionOptions(), null, null
Session(SessionOptions sessionOptions)
          Create a session with the specified sessionOptions
Session(SessionOptions sessionOptions, EventHandler handler)
          Create a session with the specified sessionOptions and dispatch events on this session to the specified handler
Session(SessionOptions sessionOptions, EventHandler eventHandler, EventDispatcher eventDispatcher)
          Create a session with the specified sessionOptions and dispatch events on this session using the provided dispatcher to the specified handler
 
Method Summary
 void resubscribe(SubscriptionList subscriptionList)
          Modify each subscription in the specified subscriptionList to reflect the modified options specified for it.
 void resubscribe(SubscriptionList subscriptionList, int resubId)
          Modify each subscription in the specified subscriptionList to reflect the modified options specified for it.
 void resubscribe(SubscriptionList subscriptionList, int resubId, java.lang.String requestLabel)
          Modify each subscription in the specified subscriptionList to reflect the modified options specified for it.
 void resubscribe(SubscriptionList subscriptionList, java.lang.String requestLabel)
          Modify each subscription in the specified subscriptionList to reflect the modified options specified for it.
 CorrelationID sendRequest(Request request, CorrelationID correlationId)
          Send the specified request to a service using this session
 CorrelationID sendRequest(Request request, CorrelationID correlationId, java.lang.String requestLabel)
          Send the specified request to a service using this session
 CorrelationID sendRequest(Request request, EventQueue eventQueue, CorrelationID correlationId)
          Send the specified request to a service using this session
 CorrelationID sendRequest(Request request, EventQueue eventQueue, CorrelationID correlationId, java.lang.String requestLabel)
          Send the specified request to a service using this session
 CorrelationID sendRequest(Request request, Identity identity, CorrelationID correlationId)
          Send the specified request to a service using this session
 CorrelationID sendRequest(Request request, Identity identity, CorrelationID correlationId, java.lang.String requestLabel)
          Send the specified request to a service using this session
 CorrelationID sendRequest(Request request, Identity identity, EventQueue eventQueue, CorrelationID correlationId)
          Send the specified request to a service using this session
 CorrelationID sendRequest(Request request, Identity identity, EventQueue eventQueue, CorrelationID correlationId, java.lang.String requestLabel)
          Send the specified request to a service using this session
 CorrelationID sendRequest(Request request, UserHandle identity, CorrelationID correlationId)
          Deprecated. as of 3.3.0, use sendRequest(Request, Identity, CorrelationID) instead
 CorrelationID sendRequest(Request request, UserHandle identity, CorrelationID correlationId, java.lang.String requestLabel)
          Deprecated. as of 3.3.0, use sendRequest(Request, Identity, CorrelationID, String) instead
 CorrelationID sendRequest(Request request, UserHandle identity, EventQueue eventQueue, CorrelationID correlationId)
          Deprecated. as of 3.3.0, use sendRequest(Request, Identity, EventQueue, CorrelationID) instead
 CorrelationID sendRequest(Request request, UserHandle identity, EventQueue eventQueue, CorrelationID correlationId, java.lang.String requestLabel)
          Deprecated. as of 3.3.0, use sendRequest(Request, Identity, EventQueue, CorrelationID, String) instead
 void setEventHandler(EventHandler eventHandler, Event.EventType eventType)
          Set event specific event handlers
 void subscribe(SubscriptionList subscriptionList)
          Initiate a request to receive asynchronous updates to the specified topics.
 void subscribe(SubscriptionList subscriptionList, Identity identity)
          Initiate a request to receive asynchronous updates to the specified topics.
 void subscribe(SubscriptionList subscriptionList, Identity identity, java.lang.String requestLabel)
          Initiate a request to receive asynchronous updates to the specified topics in the subscriptionList.
 void subscribe(SubscriptionList subscriptionList, java.lang.String requestLabel)
          Initiate a request to receive asynchronous updates to the specified topics.
 void subscribe(SubscriptionList subscriptionList, UserHandle Identity)
          Deprecated. as of 3.3.0, use subscribe(SubscriptionList, Identity) instead
 void subscribe(SubscriptionList subscriptionList, UserHandle identity, java.lang.String requestLabel)
          Deprecated. as of 3.3.0, use subscribe(SubscriptionList, Identity, String) instead
 SubscriptionIterator subscriptionIterator()
          Returns an an iterator for iterating over the subscriptions.
 int subscriptionStatus(CorrelationID correlationId)
          Returns the subscription status for the specified correlationId
 java.lang.String subscriptionString(CorrelationID correlationId)
          Returns the subscription string for the specified correlationId
 void unsubscribe(CorrelationID correlationId)
          Deprecated. as of 3.2.2 Use AbstractSession.cancel(CorrelationID) instead
 void unsubscribe(SubscriptionList subscriptionList)
          Cancel previous requests for asynchronous topic updates associated with the correlation ids listed in the specified subscriptionList
 void unsubscribe(SubscriptionList subscriptionList, java.lang.String requestLabel)
          Cancel previous requests for asynchronous topic updates associated with the correlation ids listed in the specified subscriptionList
 
Methods inherited from class com.bloomberglp.blpapi.AbstractSession
cancel, cancel, cancel, cancel, createIdentity, createUserHandle, generateToken, generateToken, generateToken, getService, nextEvent, nextEvent, openService, openServiceAsync, openServiceAsync, sendAuthorizationRequest, sendAuthorizationRequest, sendAuthorizationRequest, sendAuthorizationRequest, sendAuthorizationRequest, sendAuthorizationRequest, sendAuthorizationRequest, sendAuthorizationRequest, start, startAsync, stop, stop, tryNextEvent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Session

public Session()
Same as calling Session(SessionOptions(), null, null


Session

public Session(SessionOptions sessionOptions)
Create a session with the specified sessionOptions

Same as calling Session(sessionOptions, null, null)


Session

public Session(SessionOptions sessionOptions,
               EventHandler handler)
Create a session with the specified sessionOptions and dispatch events on this session to the specified handler

Same as calling Session(sessionOptions, handler, null


Session

public Session(SessionOptions sessionOptions,
               EventHandler eventHandler,
               EventDispatcher eventDispatcher)
Create a session with the specified sessionOptions and dispatch events on this session using the provided dispatcher to the specified handler

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 it's 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.

Parameters:
sessionOptions - values in SessionOptions are used for configuring this session
eventHandler - the event handler to which all events are delivered
eventDispatcher - The dispatcher to be used for dispatching events.
Method Detail

subscribe

public void subscribe(SubscriptionList subscriptionList)
               throws java.io.IOException
Initiate a request to receive asynchronous updates to the specified topics.

same as calling subscribe(subscriptionList, null, null

Parameters:
subscriptionList - the list of subscription strings to subscribe
Throws:
java.lang.IllegalStateException - if the session is not established
DuplicateCorrelationIDException - if any of the correlationIds specified in the subscriptionList is not unique
java.io.IOException - if there is any communication error on subscribe

subscribe

public void subscribe(SubscriptionList subscriptionList,
                      java.lang.String requestLabel)
               throws java.io.IOException
Initiate a request to receive asynchronous updates to the specified topics.

same as calling subscribe(subscriptionList, null, requestLabel

Parameters:
subscriptionList - the list of subscription strings to subscribe
requestLabel - defines a string which will be recorded along with any diagnostics for this operation.
Throws:
java.lang.IllegalStateException - if the session is not established
DuplicateCorrelationIDException - if any of the correlationIds specified in the subscriptionList is not unique
java.io.IOException - if there is any communication error on subscribe

subscribe

public void subscribe(SubscriptionList subscriptionList,
                      Identity identity)
               throws java.io.IOException
Initiate a request to receive asynchronous updates to the specified topics.

same as calling subscribe(subscriptionList, identity, null

Parameters:
subscriptionList - the list of subscription strings to subscribe
identity - the handle to the user for whom this subscription is being initiated
Throws:
java.lang.IllegalStateException - if the session is not established
DuplicateCorrelationIDException - if any of the correlationIds specified in the subscriptionList is not unique
java.io.IOException - if there is any communication error on subscribe
java.lang.IllegalArgumentException - if the specified Identity was not created through this Session

subscribe

public void subscribe(SubscriptionList subscriptionList,
                      UserHandle Identity)
               throws java.io.IOException
Deprecated. as of 3.3.0, use subscribe(SubscriptionList, Identity) instead

Throws:
java.io.IOException

subscribe

public void subscribe(SubscriptionList subscriptionList,
                      Identity identity,
                      java.lang.String requestLabel)
               throws java.io.IOException
Initiate a request to receive asynchronous updates to the specified topics in the subscriptionList.

Once this has method has returned any subscriptions in the specified subscriptionList which were not given a application generated CorrelationID will have a session generated CorrelationID set. Multiple subscriptions to the same subscriptionString are valid and each will have their own, unique CorrelationID. This method should only be called after the Session has successfully started up. If an exception is thrown none of the subscriptions in the list would have been processed.

If a identity is specified then the subscribe request is issued on behalf of the user represented by the handle. Use the sendAuthorizationRequest to authorize an user for accessing the specified service

Upon completion of this request a Event.EventType.SUBSCRIPTION_STATUS event will be published for each topic in the subscription list containing a message with the result for one topic. A "SubscriptionStarted" message will be generated if the subscription was successfully initiated. If the subscription fails for any topic a "SubscriptionFailure" message containing the failure reason will be generated

Parameters:
identity - the handle to the user for whom this subscription is being initiated
requestLabel - defines a string which will be recorded along with any diagnostics for this operation.
Throws:
java.lang.IllegalStateException - if the session is not established
DuplicateCorrelationIDException - if any of the correlationIds specified in the subscriptionList is not unique
java.io.IOException - if there is any communication error on subscribe
java.lang.IllegalArgumentException - if the specified Identity was not created through this Session

subscribe

public void subscribe(SubscriptionList subscriptionList,
                      UserHandle identity,
                      java.lang.String requestLabel)
               throws java.io.IOException
Deprecated. as of 3.3.0, use subscribe(SubscriptionList, Identity, String) instead

Throws:
java.io.IOException

resubscribe

public void resubscribe(SubscriptionList subscriptionList)
                 throws java.io.IOException
Modify each subscription in the specified subscriptionList to reflect the modified options specified for it.

Same as calling resubscribe(subscriptionList, null)

Parameters:
subscriptionList - a list of active subscriptions whose options need to be changed
Throws:
NotFoundException - If any of the CorrelationIDs specified in the subscriptionList is not a valid subscription
java.io.IOException - if there is any communication error on reSubscribe
java.lang.IllegalStateException - if the session is not established

resubscribe

public void resubscribe(SubscriptionList subscriptionList,
                        int resubId)
                 throws java.io.IOException
Modify each subscription in the specified subscriptionList to reflect the modified options specified for it.

Same as calling resubscribe(subscriptionList, resubId, null)

Parameters:
subscriptionList - a list of active subscriptions whose options need to be changed
resubId - an integer that identifies this request and appears in the SUBSCRIPTION_STATUS event
Throws:
NotFoundException - If any of the CorrelationIDs specified in the subscriptionList is not a valid subscription
java.io.IOException - if there is any communication error on reSubscribe
java.lang.IllegalStateException - if the session is not established

resubscribe

public void resubscribe(SubscriptionList subscriptionList,
                        java.lang.String requestLabel)
                 throws java.io.IOException
Modify each subscription in the specified subscriptionList to reflect the modified options specified for it.

For each entry in the subscriptionList the CorrelationID identifies a current "active" subscription the modified options replace the current options for the subscription and a Event.EventType.SUBSCRIPTION_STATUS event will be generated in the event stream before the first update based on the new options.

Parameters:
subscriptionList - a list of active subscriptions whose options need to be changed
requestLabel - defines a string which will be recorded along with any diagnostics for this operation.
Throws:
NotFoundException - If any of the CorrelationIDs specified in the subscriptionList is not a valid subscription
java.io.IOException - if there is any communication error on reSubscribe
java.lang.IllegalStateException - if the session is not established

resubscribe

public void resubscribe(SubscriptionList subscriptionList,
                        int resubId,
                        java.lang.String requestLabel)
                 throws java.io.IOException
Modify each subscription in the specified subscriptionList to reflect the modified options specified for it.

For each entry in the subscriptionList the CorrelationID identifies a current "active" subscription the modified options replace the current options for the subscription and a Event.EventType.SUBSCRIPTION_STATUS event will be generated in the event stream before the first update based on the new options. The event will contain a message with the specified 'resubId'.

Parameters:
subscriptionList - a list of active subscriptions whose options need to be changed
resubId - an integer that identifies this request and appears in the SUBSCRIPTION_STATUS event
requestLabel - defines a string which will be recorded along with any diagnostics for this operation.
Throws:
NotFoundException - If any of the CorrelationIDs specified in the subscriptionList is not a valid subscription
java.io.IOException - if there is any communication error on reSubscribe
java.lang.IllegalStateException - if the session is not established

unsubscribe

public void unsubscribe(CorrelationID correlationId)
                 throws java.io.IOException
Deprecated. as of 3.2.2 Use AbstractSession.cancel(CorrelationID) instead

Cancel a previous request for asynchronous topic updates associated with the specified correlationId

Parameters:
correlationId - the correlationId of the subscription that is to be unsubscribed
Throws:
java.io.IOException - if any IO error occurs while unsubscribing

unsubscribe

public void unsubscribe(SubscriptionList subscriptionList)
                 throws java.io.IOException
Cancel previous requests for asynchronous topic updates associated with the correlation ids listed in the specified subscriptionList

This operation provides a convenience for cancelling Subscriptions using a SubscriptionList.

See AbstractSession.cancel(List, String) operation for more information on the handling of cancel requests and other important notes.

Parameters:
subscriptionList - list of correlationIds of subscriptions that are to be unsubscribed
Throws:
java.io.IOException - if any IO error occurs while unsubscribing

unsubscribe

public void unsubscribe(SubscriptionList subscriptionList,
                        java.lang.String requestLabel)
                 throws java.io.IOException
Cancel previous requests for asynchronous topic updates associated with the correlation ids listed in the specified subscriptionList

This operation provides a convenience for cancelling Subscriptions using a SubscriptionList.

See AbstractSession.cancel(List, String) operation for more information on the handling of cancel requests and other important notes.

Parameters:
subscriptionList - list of correlationIds of subscriptions that are to be unsubscribed
requestLabel - defines a string which will be recorded along with any diagnostics for this operation.
Throws:
java.io.IOException - if any IO error occurs while unsubscribing

subscriptionStatus

public int subscriptionStatus(CorrelationID correlationId)
Returns the subscription status for the specified correlationId

Parameters:
correlationId - the correlation id for which the subscription status is required
Returns:
the subscription status for the specified correlationId
Throws:
NotFoundException - if the specified correlationId has no associated subscription

subscriptionString

public java.lang.String subscriptionString(CorrelationID correlationId)
Returns the subscription string for the specified correlationId

Parameters:
correlationId - the correlation id for which the subscription string is required
Returns:
the subscription string for the specified correlationId
Throws:
NotFoundException - if the specified correlationId has no associated subscription

sendRequest

public CorrelationID sendRequest(Request request,
                                 CorrelationID correlationId)
                          throws java.io.IOException
Send the specified request to a service using this session

Same as calling sendRequest(Request, Identity, EventQueue, CorrelationID, String) with a null identity, EventQueue and a null request label string parameter

Parameters:
request - Filled in request that needs to be sent to the service
correlationId - The correlationId to be used to match the response
Returns:
a internally generated CorrelationID if the specified correlationId is null or return the specified correlationId
Throws:
java.lang.IllegalStateException - If the session is not established
InvalidRequestException - If the request is not compliant with the schema for the request
RequestQueueOverflowException - If this session has too many enqueued requests
java.io.IOException - If any error occurs while sending the request
DuplicateCorrelationIDException - If the specified correlationId is already active for this Session

sendRequest

public CorrelationID sendRequest(Request request,
                                 CorrelationID correlationId,
                                 java.lang.String requestLabel)
                          throws java.io.IOException
Send the specified request to a service using this session

Same as calling sendRequest(Request, Identity, EventQueue, CorrelationID, String) with a null identity and EventQueue

Parameters:
request - Filled in request that needs to be sent to the service
correlationId - The correlationId to be used to match the response
requestLabel - defines a string which will be recorded along with any diagnostics for this operation.
Returns:
a internally generated CorrelationID if the specified correlationId is null or return the specified correlationId
Throws:
java.lang.IllegalStateException - If the session is not established
InvalidRequestException - If the request is not compliant with the schema for the request
RequestQueueOverflowException - If this session has too many enqueued requests
java.io.IOException - If any error occurs while sending the request
DuplicateCorrelationIDException - If the specified correlationId is already active for this Session

sendRequest

public CorrelationID sendRequest(Request request,
                                 Identity identity,
                                 CorrelationID correlationId)
                          throws java.io.IOException
Send the specified request to a service using this session

Same as calling sendRequest(Request, Identity, EventQueue, CorrelationID, String) with a null EventQueue and a null request label string parameter

Parameters:
request - Filled in request that needs to be sent to the service
identity - handle to the user whose privileges are to be used for this request
correlationId - The correlationId to be used to match the response
Returns:
a internally generated CorrelationID if the specified correlationId is null or return the specified correlationId
Throws:
java.lang.IllegalStateException - If the session is not established
InvalidRequestException - If the request is not compliant with the schema for the request
RequestQueueOverflowException - If this session has too many enqueued requests
java.io.IOException - If any error occurs while sending the request
DuplicateCorrelationIDException - If the specified correlationId is already active for this Session
java.lang.IllegalArgumentException - if the specified Identity was not created through this Session

sendRequest

public CorrelationID sendRequest(Request request,
                                 UserHandle identity,
                                 CorrelationID correlationId)
                          throws java.io.IOException
Deprecated. as of 3.3.0, use sendRequest(Request, Identity, CorrelationID) instead

Throws:
java.io.IOException

sendRequest

public CorrelationID sendRequest(Request request,
                                 Identity identity,
                                 CorrelationID correlationId,
                                 java.lang.String requestLabel)
                          throws java.io.IOException
Send the specified request to a service using this session

Same as calling sendRequest(Request, Identity, EventQueue, CorrelationID, String) with a null EventQueue

Parameters:
request - Filled in request that needs to be sent to the service
identity - handle to the user whose privileges are to be used for this request
correlationId - The correlationId to be used to match the response
requestLabel - defines a string which will be recorded along with any diagnostics for this operation.
Returns:
a internally generated CorrelationID if the specified correlationId is null or return the specified correlationId
Throws:
java.lang.IllegalStateException - If the session is not established
InvalidRequestException - If the request is not compliant with the schema for the request
RequestQueueOverflowException - If this session has too many enqueued requests
java.io.IOException - If any error occurs while sending the request
DuplicateCorrelationIDException - If the specified correlationId is already active for this Session
java.lang.IllegalArgumentException - if the specified Identity was not created through this Session

sendRequest

public CorrelationID sendRequest(Request request,
                                 UserHandle identity,
                                 CorrelationID correlationId,
                                 java.lang.String requestLabel)
                          throws java.io.IOException
Deprecated. as of 3.3.0, use sendRequest(Request, Identity, CorrelationID, String) instead

Throws:
java.io.IOException

sendRequest

public CorrelationID sendRequest(Request request,
                                 EventQueue eventQueue,
                                 CorrelationID correlationId)
                          throws java.io.IOException
Send the specified request to a service using this session

Same as calling sendRequest(Request, Identity, EventQueue, CorrelationID, String) with a null identity and a null request label string parameter

Parameters:
request - Filled in request that needs to be sent to the service
eventQueue - to be used to receive response events for this request
correlationId - The correlationId to be used to match the response
Returns:
a internally generated CorrelationID if the specified correlationId is null or return the specified correlationId
Throws:
java.lang.IllegalStateException - If the session is not established
InvalidRequestException - If the request is not compliant with the schema for the request
RequestQueueOverflowException - If this session has too many enqueued requests
java.io.IOException - If any error occurs while sending the request
DuplicateCorrelationIDException - If the specified correlationId is already active for this Session

sendRequest

public CorrelationID sendRequest(Request request,
                                 EventQueue eventQueue,
                                 CorrelationID correlationId,
                                 java.lang.String requestLabel)
                          throws java.io.IOException
Send the specified request to a service using this session

Same as calling sendRequest(Request, Identity, EventQueue, CorrelationID, String) with a null identity

Parameters:
request - Filled in request that needs to be sent to the service
eventQueue - to be used to receive response events for this request
correlationId - The correlationId to be used to match the response
requestLabel - defines a string which will be recorded along with any diagnostics for this operation.
Returns:
a internally generated CorrelationID if the specified correlationId is null or return the specified correlationId
Throws:
java.lang.IllegalStateException - If the session is not established
InvalidRequestException - If the request is not compliant with the schema for the request
RequestQueueOverflowException - If this session has too many enqueued requests
java.io.IOException - If any error occurs while sending the request
DuplicateCorrelationIDException - If the specified correlationId is already active for this Session

sendRequest

public CorrelationID sendRequest(Request request,
                                 Identity identity,
                                 EventQueue eventQueue,
                                 CorrelationID correlationId)
                          throws java.io.IOException
Send the specified request to a service using this session

Same as calling sendRequest(Request, Identity, EventQueue, CorrelationID, String) with a null request label string parameter

Parameters:
request - Filled in request that needs to be sent to the service
identity - handle to the user whose privileges are to be used for this request
eventQueue - to be used to receive response events for this request
correlationId - The correlationId to be used to match the response
Returns:
a internally generated CorrelationID if the specified correlationId is null or return the specified correlationId
Throws:
java.lang.IllegalStateException - If the session is not established
InvalidRequestException - If the request is not compliant with the schema for the request
RequestQueueOverflowException - If this session has too many enqueued requests
java.io.IOException - If any error occurs while sending the request
DuplicateCorrelationIDException - If the specified correlationId is already active for this Session
java.lang.IllegalArgumentException - if the specified Identity was not created through this Session

sendRequest

public CorrelationID sendRequest(Request request,
                                 UserHandle identity,
                                 EventQueue eventQueue,
                                 CorrelationID correlationId)
                          throws java.io.IOException
Deprecated. as of 3.3.0, use sendRequest(Request, Identity, EventQueue, CorrelationID) instead

Throws:
java.io.IOException

sendRequest

public CorrelationID sendRequest(Request request,
                                 Identity identity,
                                 EventQueue eventQueue,
                                 CorrelationID correlationId,
                                 java.lang.String requestLabel)
                          throws java.io.IOException
Send the specified request to a service using this session

This method sends the specified request to a service that is available on this session. The specified correlationId is returned on the response and can be used to correlate the response to this request. If a null correlationId is specified then an internal CorrelationID is generated and returned.

If a valid identity is specified then it used as authorization for the specified request. If a valid identity is not specified then the request runs with the default authorization. sendAuthorizationRequest for more information

If an eventQueue is specified then all response events for this Request are published to this eventQueue. The user can block on this event queue for response and can use this as a mechanism to convert this asynchronous request into a synchronous request

A successful request will generate zero or more Event.EventType.PARTIAL_RESPONSE events followed by exactly one Event.EventType.RESPONSE event. Once the final RESPONSE event has been received the CorrelationID associated with this request may be re-used. If the request fails at any stage a Event.EventType.REQUEST_STATUS event will be generated after which the CorrelationId associated with the request may be re-used.

Parameters:
request - Filled in request that needs to be sent to the service
identity - handle to the user whose privileges are to be used for this request
eventQueue - to be used to receive response events for this request
correlationId - The correlationId to be used to match the response
requestLabel - defines a string which will be recorded along with any diagnostics for this operation.
Returns:
a internally generated CorrelationID if the specified correlationId is null or return the specified correlationId
Throws:
java.lang.IllegalStateException - If the session is not established
InvalidRequestException - If the request is not compliant with the schema for the request
RequestQueueOverflowException - If this session has too many enqueued requests
java.io.IOException - If any error occurs while sending the request
DuplicateCorrelationIDException - If the specified correlationId is already active for this Session
java.lang.IllegalArgumentException - if the specified Identity was not created through this Session

sendRequest

public CorrelationID sendRequest(Request request,
                                 UserHandle identity,
                                 EventQueue eventQueue,
                                 CorrelationID correlationId,
                                 java.lang.String requestLabel)
                          throws java.io.IOException
Deprecated. as of 3.3.0, use sendRequest(Request, Identity, EventQueue, CorrelationID, String) instead

Throws:
java.io.IOException

setEventHandler

public void setEventHandler(EventHandler eventHandler,
                            Event.EventType eventType)
Set event specific event handlers

Parameters:
eventHandler - new event handler to replace default event handler provided at construction
eventType - type of events to be delivered to the new handler

subscriptionIterator

public SubscriptionIterator subscriptionIterator()
Returns an an iterator for iterating over the subscriptions.

Returns an an iterator for iterating over the subscriptions in this session. Note that the returned subscriptions have no defined order.

Returns:
a iterator for iteration over the subscriptions


Copyright © 2015 Bloomberg L.P.. All Rights Reserved.