Package com.opengamma.livedata.cogda.msg

Examples of com.opengamma.livedata.cogda.msg.CogdaLiveDataSubscriptionRequestMessage


    for (SubscriptionHandle handle : subHandle) {
      long correlationId = _nextRequestId.getAndIncrement();
      switch (handle.getSubscriptionType()) {
        case NON_PERSISTENT:
        case PERSISTENT:
          CogdaLiveDataSubscriptionRequestMessage subRequest = new CogdaLiveDataSubscriptionRequestMessage();
          subRequest.setCorrelationId(correlationId);
          subRequest.setNormalizationScheme(handle.getRequestedSpecification().getNormalizationRuleSetId());
          // REVIEW kirk 2012-08-15 -- The next line is SOOOOO UGLLYYYYY!!!!!
          subRequest.setSubscriptionId(handle.getRequestedSpecification().getIdentifiers().getExternalIds().iterator().next());
          _activeSubscriptionRequests.put(correlationId, handle);
          _messageSender.send(CogdaLiveDataSubscriptionRequestBuilder.buildMessageStatic(new FudgeSerializer(getFudgeContext()), subRequest));
          // Same thing in Cogda.
          break;
        case SNAPSHOT:
View Full Code Here


  /**
   * @param fudgeContext
   * @param msg
   */
  private CogdaLiveDataCommandResponseMessage handleSubscriptionRequest(FudgeContext fudgeContext, FudgeMsg msg) {
    CogdaLiveDataSubscriptionRequestMessage request = CogdaLiveDataSubscriptionRequestBuilder.buildObjectStatic(new FudgeDeserializer(fudgeContext), msg);
    CogdaLiveDataSubscriptionResponseMessage response = new CogdaLiveDataSubscriptionResponseMessage();
    response.setCorrelationId(request.getCorrelationId());
    response.setSubscriptionId(request.getSubscriptionId());
    response.setNormalizationScheme(request.getNormalizationScheme());
   
    // TODO kirk 2012-07-23 -- Check entitlements.
    if (!getServer().isValidLiveData(request.getSubscriptionId(), request.getNormalizationScheme())) {
      response.setGenericResult(CogdaCommandResponseResult.NOT_AVAILABLE);
    } else if (!isEntitled(EntitlementUtils.SUBSCRIBE, request.getSubscriptionId(), request.getNormalizationScheme())) {
      response.setGenericResult(CogdaCommandResponseResult.NOT_AUTHORIZED);
    } else {
      LastKnownValueStore lkvStore = getServer().getLastKnownValueStore(request.getSubscriptionId(), request.getNormalizationScheme());
      FudgeMsg fields = null;
      if (lkvStore != null) {
        fields = lkvStore.getFields();
      } else {
        s_logger.warn("Valid live data {} lacks fields in LKV store", request);
        fields = fudgeContext.newMessage();
      }
     
      response.setGenericResult(CogdaCommandResponseResult.SUCCESSFUL);
      response.setSnapshot(fields);
     
      _subscriptions.putIfAbsent(new LiveDataSpecification(request.getNormalizationScheme(), request.getSubscriptionId()), Boolean.TRUE);
    }
    return response;
  }
View Full Code Here

TOP

Related Classes of com.opengamma.livedata.cogda.msg.CogdaLiveDataSubscriptionRequestMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.