Map<LiveDataSpecification, DistributionSpecification> resolved = getDistributionSpecificationResolver().resolve(liveDataSpecificationsFromClient);
for (LiveDataSpecification liveDataSpecificationFromClient : liveDataSpecificationsFromClient) {
DistributionSpecification distributionSpec = resolved.get(liveDataSpecificationFromClient);
LiveDataSpecification fullyQualifiedSpec = distributionSpec.getFullyQualifiedLiveDataSpecification();
MarketDataDistributor currentlyActiveDistributor = getMarketDataDistributor(distributionSpec);
if (currentlyActiveDistributor != null) {
if (currentlyActiveDistributor.getSnapshot() != null) {
//NOTE simon 28/11/2011: We presume that all the fields were provided in one go, all or nothing.
s_logger.debug("Able to satisfy {} from existing LKV", liveDataSpecificationFromClient);
LiveDataValueUpdateBean snapshot = currentlyActiveDistributor.getSnapshot();
responses.add(buildSnapshotResponse(liveDataSpecificationFromClient, snapshot));
continue;
} else if (canSatisfySnapshotFromEmptySubscription(currentlyActiveDistributor)) {
//BBG-91 - don't requery when an existing subscription indicates that the snapshot will fail
s_logger.debug("Able to satisfy failed snapshot {} from existing LKV", liveDataSpecificationFromClient);
String errorMsg = "Existing subscription for " + currentlyActiveDistributor.getDistributionSpec().getMarketDataId() +
" failed to retrieve a snapshot. Perhaps required fields are unavailable.";
responses.add(buildErrorMessageResponse(liveDataSpecificationFromClient, LiveDataSubscriptionResult.INTERNAL_ERROR, errorMsg));
continue;
} else {
s_logger.debug("Can't use existing subscription to satisfy {} from existing LKV", liveDataSpecificationFromClient);