SessioncreateSnapshotRequestTemplate Method (String, CorrelationID, Identity) |
The benefit of the snapshot service request templates is that these requests may be serviced from a cache and the user may expect to see significantly lower response time.
There are 3 possible states for a created request template: 'Pending', 'Available', and 'Terminated'. A 'RequestTemplate' is initially in the 'Pending' state.
The user may send a request using a template that is in 'Pending' state. If this succeeds, the state of that template changes to 'Available'. Note that response times to receive data may be longer than a response time for a request in the 'Available' state since request caches may not yet have been established. A template may transition back into 'Pending' state from the 'Available' state, in which case a 'RequestTemplatePending' message will be generated.
If state is 'Available', all requests will be serviced from a cache and the user may expect to see significantly reduced latency. Note, that a snapshot request template can transition out of the 'Available' state concurrently with requests being sent, so no guarantee of service from the cache can be provided. Request template may transition into 'Available' state only from the 'Pending' state. In this case the 'RequestTemplateAvailable' message is generated. This message will also contain information about currently used connection in the 'boundTo' field. Note that it is possible to get the 'RequestTemplateAvailable' message with a new connection information, even if a request template is already in the 'Available' state.
If state is 'Terminated', sending request will always result in a failure response. Request template may transition into this state from any other state. This is a final state and it is guaranteed that the last message associated with the provided 'statusCid' will be the 'RequestTemplateTerminated' message which is generated when a request template transitions into this state. If a request template transitions into this state, all outstanding requests will be failed and appropriate messages will be generated for each request. After receiving the 'RequestTemplateTerminated' message, 'statusCid' may be reused.
Note that resources used by a snapshot service request template are released only when request template transitions into the 'Terminated' state or when session is destroyed. In order to release resources when request template is not needed anymore, user should call Cancel(CorrelationID) or close unless the 'RequestTemplateTerminated' message was already received due to some problems. If the 'Session.cancel' method is used, all outstanding requests are canceled and the underlying subscription is closed immediately. If the handle is closed with the 'RequestTemplate.close' method, the underlying subscription is closed only when all outstanding requests are served. Note that it is possible to have a situation when response contain data that were sent by a backend before user actually sends a request template. For example it is possible if user requested data were already in an incoming TCP queue.
Namespace: Bloomberglp.Blpapi
public RequestTemplate createSnapshotRequestTemplate( string subscriptionString, CorrelationID statusCid, Identity identity )
Exception | Condition |
---|---|
ArgumentException | Thrown if no subscription string specified |
DuplicateCorrelationIDException | Thrown if the provided status correlation id is already used |
InvalidOperationException | Thrown if the session is not in 'Established' state or no subscription management endpoints are available |
IOException | Thrown if a network communication problem happens |