Examples of LiveDataSubscriptionResponse


Examples of com.opengamma.livedata.msg.LiveDataSubscriptionResponse

  @Override
  protected void handleSubscriptionRequest(Collection<SubscriptionHandle> subHandles) {
    _subscriptionRequests.add(subHandles);
    for (SubscriptionHandle subHandle : subHandles) {
      LiveDataSubscriptionResponse response = new LiveDataSubscriptionResponse(
          subHandle.getRequestedSpecification(),
          LiveDataSubscriptionResult.SUCCESS,
          null,
          subHandle.getRequestedSpecification(),
          "test distribution spec",
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionResponse

  }

  private void getMethods(String uniqueId, boolean persistent) {
    LiveDataSpecification spec = getSpec(uniqueId);

    LiveDataSubscriptionResponse result = _server.subscribe(uniqueId, persistent);

    assertNotNull(result);
    assertTrue(result.getSubscriptionResult() == LiveDataSubscriptionResult.SUCCESS);

    String distributionSpec = result.getTickDistributionSpecification();
    assertNotNull(distributionSpec);

    Subscription subscription = _server.getSubscription(uniqueId);

    assertNotNull(subscription);
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionResponse

      } catch (Exception e) {
        s_logger.error("Failed to process response message", e);
       
        for (SubscriptionHandle handle : getSpec2SubHandle().values()) {
          if (handle.getSubscriptionType() != SubscriptionType.SNAPSHOT) {
            subscriptionRequestFailed(handle, new LiveDataSubscriptionResponse(
                handle.getRequestedSpecification(),
                LiveDataSubscriptionResult.INTERNAL_ERROR,
                e.toString(),
                null,
                null,
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionResponse

      int total = responses.size();
      s_logger.info("{} subscription responses received", total);
      Map<LiveDataListener, Collection<LiveDataSubscriptionResponse>> batch = new HashMap<>();
      for (Map.Entry<SubscriptionHandle, LiveDataSubscriptionResponse> successEntry : responses.entrySet()) {
        SubscriptionHandle handle = successEntry.getKey();
        LiveDataSubscriptionResponse response = successEntry.getValue();
        Collection<LiveDataSubscriptionResponse> responseBatch = batch.get(handle.getListener());
        if (responseBatch == null) {
          responseBatch = new LinkedList<>();
          batch.put(handle.getListener(), responseBatch);
        }
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionResponse

    protected void sendResponse() {
      super.sendResponse();
     
      for (Map.Entry<SubscriptionHandle, LiveDataSubscriptionResponse> successEntry : getSuccessResponses().entrySet()) {
        SubscriptionHandle handle = successEntry.getKey();
        LiveDataSubscriptionResponse response = successEntry.getValue();
        subscriptionRequestSatisfied(handle, response);
      }
     
      for (Map.Entry<SubscriptionHandle, LiveDataSubscriptionResponse> failedEntry : getFailedResponses().entrySet()) {
        SubscriptionHandle handle = failedEntry.getKey();
        LiveDataSubscriptionResponse response = failedEntry.getValue();
        subscriptionRequestFailed(handle, response);
       
        // this is here just to clean up. It's safe to call stopReceivingTicks()
        // even if no JMS subscription actually exists.
        stopReceivingTicks(response.getTickDistributionSpecification());
      }
    }
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionResponse

    if (results == null || results.size() != 1) {
      String errorMsg = "subscribe() did not fulfill its contract to populate map for each live data spec";
      return buildErrorMessageResponse(liveDataSpecificationFromClient, LiveDataSubscriptionResult.INTERNAL_ERROR, errorMsg);
    }
    LiveDataSubscriptionResponse result = results.iterator().next();
    if (!liveDataSpecificationFromClient.equals(result.getRequestedSpecification())) {
      String errorMsg = "Expected a subscription result for " + liveDataSpecificationFromClient + " but received one for " + result.getRequestedSpecification();
      return buildErrorMessageResponse(liveDataSpecificationFromClient, LiveDataSubscriptionResult.INTERNAL_ERROR, errorMsg);
    }

    return result;
  }
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionResponse

   * @param message the error message, not null
   * @return the response, not null
   */
  protected LiveDataSubscriptionResponse buildErrorMessageResponse(
      LiveDataSpecification liveDataSpecificationFromClient, LiveDataSubscriptionResult result, String message) {
    return new LiveDataSubscriptionResponse(liveDataSpecificationFromClient, result, message, null, null, null);
  }
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionResponse

   * @param snapshot the snapshot, not null
   * @return the response, not null
   */
  protected LiveDataSubscriptionResponse buildSnapshotResponse(
      LiveDataSpecification liveDataSpecificationFromClient, LiveDataValueUpdateBean snapshot) {
    return new LiveDataSubscriptionResponse(
        liveDataSpecificationFromClient, LiveDataSubscriptionResult.SUCCESS,
        null, snapshot.getSpecification(), null, snapshot);
  }
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionResponse

   * @param distributionSpec the subscription, not null
   * @return the response, not null
   */
  protected LiveDataSubscriptionResponse buildSubscriptionResponse(
      LiveDataSpecification liveDataSpecificationFromClient, DistributionSpecification distributionSpec) {
    return new LiveDataSubscriptionResponse(
        liveDataSpecificationFromClient, LiveDataSubscriptionResult.SUCCESS,
        null, distributionSpec.getFullyQualifiedLiveDataSpecification(), distributionSpec.getJmsTopic(), null);
  }
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionResponse

      + " no-op. Returns the name of the JMS topic market data will be published on.")
  @ManagedOperationParameters({
      @ManagedOperationParameter(name = "securityUniqueId", description = "Security unique ID. Server type dependent.)") })
  public String subscribe(String securityUniqueId) {
    try {
      LiveDataSubscriptionResponse response = getServer().subscribe(securityUniqueId);
      if (response.getSubscriptionResult() != LiveDataSubscriptionResult.SUCCESS) {
        throw new RuntimeException("Unsuccessful subscription: " + response.getUserMessage());
      }
      return response.getTickDistributionSpecification();
    } catch (RuntimeException e) {
      s_logger.error("subscribe(" + securityUniqueId + ") failed", e);
      throw new RuntimeException(e.getMessage());
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.