Examples of LiveDataSubscriptionRequest


Examples of com.opengamma.livedata.msg.LiveDataSubscriptionRequest

    LiveDataSpecification requestedSpec = new LiveDataSpecification(
        StandardRules.getNoNormalization().getId(),
        ExternalId.of(_domain, "testsub"));

    LiveDataSubscriptionRequest request = new LiveDataSubscriptionRequest(
        user,
        SubscriptionType.NON_PERSISTENT,
        Collections.singleton(requestedSpec));

    LiveDataSubscriptionResponseMsg response = _server.subscriptionRequestMade(request);
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionRequest

    LiveDataSpecification requestedSpec = new LiveDataSpecification(
        StandardRules.getNoNormalization().getId(),
        ExternalId.of(_domain, "testsub"));

    LiveDataSubscriptionRequest request = new LiveDataSubscriptionRequest(
        user,
        SubscriptionType.SNAPSHOT,
        Collections.singleton(requestedSpec));

    LiveDataSubscriptionResponseMsg response = _server.subscriptionRequestMade(request);
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionRequest

        throw new OpenGammaRuntimeException("Not all subscription types are equal");
      }
    }
   
    // Build request message
    LiveDataSubscriptionRequest subReqMessage = new LiveDataSubscriptionRequest(user, type, specs);
    FudgeMsg requestMessage = subReqMessage.toFudgeMsg(new FudgeSerializer(getFudgeContext()));
   
    // Build response receiver
    FudgeMessageReceiver responseReceiver;
    if (type == SubscriptionType.SNAPSHOT) {
      responseReceiver = new SnapshotResponseReceiver(subHandles);
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionRequest

  @Override
  @Transactional
  public FudgeMsg requestReceived(FudgeDeserializer deserializer, FudgeMsgEnvelope requestEnvelope) {
    try {
      FudgeMsg requestFudgeMsg = requestEnvelope.getMessage();
      LiveDataSubscriptionRequest subscriptionRequest = LiveDataSubscriptionRequest.fromFudgeMsg(deserializer, requestFudgeMsg);
      s_logger.debug("Received subscription request {}", subscriptionRequest);
      LiveDataSubscriptionResponseMsg subscriptionResponse = getLiveDataServer().subscriptionRequestMade(subscriptionRequest);
      s_logger.debug("Sending subscription response {}", subscriptionResponse);
      FudgeMsg responseFudgeMsg = subscriptionResponse.toFudgeMsg(new FudgeSerializer(deserializer.getFudgeContext()));
      return responseFudgeMsg;
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionRequest

  @Test(expectedExceptions =  Throwable.class)
  public void failingSubscriptionsDontStopWorking() {
    LiveDataSpecification specWorking = new LiveDataSpecification("No Normalization", ExternalId.of(_domainC, "X"));
    LiveDataSpecification specFailed = new LiveDataSpecification("No Normalization", ExternalId.of(_domainD, "X"));
    LiveDataSubscriptionResponseMsg subscriptionRequestMade = _combiningServer.subscriptionRequestMade(new LiveDataSubscriptionRequest(UserPrincipal.getLocalUser(), SubscriptionType.NON_PERSISTENT,  Lists.newArrayList(specWorking, specFailed)));
   
    assertEquals(2, subscriptionRequestMade.getResponses().size());
    for (LiveDataSubscriptionResponse response : subscriptionRequestMade.getResponses()) {
      if (response.getRequestedSpecification().equals(specWorking)) {
        assertEquals(LiveDataSubscriptionResult.SUCCESS, response.getSubscriptionResult());   
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionRequest

  public void snapshot() {
    MutableFudgeMsg msg = FudgeContext.GLOBAL_DEFAULT.newMessage();
    msg.add("FIELD", "VALUE");
    _serverC.addMarketDataMapping("X", msg);
    LiveDataSpecification spec = new LiveDataSpecification("No Normalization", ExternalId.of(_domainC, "X"));
    LiveDataSubscriptionRequest request = new LiveDataSubscriptionRequest(authorizedUser, SubscriptionType.SNAPSHOT, Collections.singleton(spec));
    LiveDataSubscriptionResponseMsg responseMsg = _combiningServer.subscriptionRequestMade(request);
    assertEquals(responseMsg.getRequestingUser(), authorizedUser);
    assertEquals(1, responseMsg.getResponses().size());
    for (LiveDataSubscriptionResponse response : responseMsg.getResponses()) {
      assertEquals(LiveDataSubscriptionResult.SUCCESS, response.getSubscriptionResult());
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionRequest

    assertEquals(0, _serverC.getSubscriptions().size());
  }

  public void entitled() {
    LiveDataSpecification spec = new LiveDataSpecification("No Normalization", ExternalId.of(_domainC, "X"));
    LiveDataSubscriptionRequest request = new LiveDataSubscriptionRequest(authorizedUser, SubscriptionType.NON_PERSISTENT, Collections.singleton(spec));
    LiveDataSubscriptionResponseMsg responseMsg = _combiningServer.subscriptionRequestMade(request);
    assertEquals(responseMsg.getRequestingUser(), authorizedUser);
    assertEquals(1, responseMsg.getResponses().size());
    for (LiveDataSubscriptionResponse response : responseMsg.getResponses()) {
      assertEquals(LiveDataSubscriptionResult.SUCCESS, response.getSubscriptionResult());
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionRequest

    assertEquals(1, _serverC.getSubscriptions().size());
  }

  public void notEntitled() {
    LiveDataSpecification spec = new LiveDataSpecification("No Normalization", ExternalId.of(_domainC, "X"));
    LiveDataSubscriptionRequest request = new LiveDataSubscriptionRequest(unauthorizedUser, SubscriptionType.NON_PERSISTENT, Collections.singleton(spec));
    LiveDataSubscriptionResponseMsg responseMsg = _combiningServer.subscriptionRequestMade(request);
    assertEquals(responseMsg.getRequestingUser(), unauthorizedUser);
    assertEquals(1, responseMsg.getResponses().size());
    for (LiveDataSubscriptionResponse response : responseMsg.getResponses()) {
      assertEquals(LiveDataSubscriptionResult.NOT_AUTHORIZED, response.getSubscriptionResult());
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionRequest

    Collection<LiveDataSubscriptionResponse> responses = subscribeByServer(
        subscriptionRequest.getSpecifications(),
        new SubscribeAction() {
          @Override
          public Collection<LiveDataSubscriptionResponse> subscribe(StandardLiveDataServer server, Collection<LiveDataSpecification> specifications) {
            LiveDataSubscriptionRequest liveDataSubscriptionRequest = buildSubRequest(subscriptionRequest, specifications);
            //NOTE: we call up to subscriptionRequestMade to get the exception catching
            LiveDataSubscriptionResponseMsg response = server.subscriptionRequestMade(liveDataSubscriptionRequest);

            //Check that we know how to combine these responses
            if (response.getRequestingUser() != subscriptionRequest.getUser()) {
View Full Code Here

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionRequest

        });
    return new LiveDataSubscriptionResponseMsg(subscriptionRequest.getUser(), responses);
  }

  private LiveDataSubscriptionRequest buildSubRequest(final LiveDataSubscriptionRequest subscriptionRequest, Collection<LiveDataSpecification> specifications) {
    LiveDataSubscriptionRequest liveDataSubscriptionRequest = new LiveDataSubscriptionRequest(subscriptionRequest.getUser(), subscriptionRequest.getType(), specifications);
    return liveDataSubscriptionRequest;
  }
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.